问题描述
-(void) alertView: ( UIAlertView *) alertView
clickedButtonAtIndex: ( NSInteger ) buttonIndex {
// do stuff
// if you want the alert to close, just call [ alertView release ]
}
有人可以解释这种方法吗?我已经习惯了-(IBAction)buttonPress:(id)sender"之类的方法,但是这个方法有三个.这些分别是什么意思?
Can someone explain this method? I'm used to methods that are like "-(IBAction)buttonPress:(id)sender" but this one has three. What do each of those mean?
MethodName:ReturnedType:InputType这样对吗?
MethodName : ReturnedType : InputTypeis this right?
推荐答案
实际上是:
-(return type) methodName:(param1 type)param1 moreMethodName:(param2 type)param2
等,具有所需的任意数量的参数.因此该方法称为alertView:clickedButtonAtIndex:
-仅嵌入了其参数.在更普通"的语言中,它等同于alertViewClickedButtonAtIndex(UIAlertView *alertView, NSInteger buttonIndex)
Etc, with as many parameters as you want. So that method is called alertView:clickedButtonAtIndex:
-- it just has its parameters embedded. It's the equivalent, in a more "normal" language, of alertViewClickedButtonAtIndex(UIAlertView *alertView, NSInteger buttonIndex)
有关Obj-C语法的不错的入门知识,请查看: http://www.cocoadevcentral.com/d/learn_objectivec/
For a pretty good primer on Obj-C syntax, check out:http://www.cocoadevcentral.com/d/learn_objectivec/
有关该特定方法的信息,请查看此文档.
For info on that particular method, check out this document.
这篇关于something:something:something方法格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!