它是在按钮“gobtn”上调用名为“inserttable”的方法的正确方法,在appdelegate中声明了whitch方法吗?
gobtn= [[UIButton alloc] initWithTitle:nil style:UIBarButtonItemStyleBordered target:self action:@selector(inserttable:)];
答案 0 :(得分:0)
所以我想你想让这个按钮调用-(void)inserttable{}
这是一个委托方法吗?
一种方式是
gobtn= [[UIButton alloc] initWithTitle:nil style:UIBarButtonItemStyleBordered target:self action:@selector(inserttable)]; // without the colon if the method takes no parameters..
-(void)inserttable
{
//Do what stuff you want
.
.
[appdelegate inserttable];// or this if you intend on passing the buttons action to call
//inserttable of the appdelegate.
}
或
gobtn= [[UIButton alloc] initWithTitle:nil style:UIBarButtonItemStyleBordered target:adddelegate action:@selector(inserttable)]; // without the colon if the method takes no parameters..