0
A
回答
1
已经创建和模板结合的方法,这样只是改变insertNewObject
方法这样
- (void)insertNewObject:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"This is an alert" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
}
0
你应该创造一个
-(IBAction)SomeAction{ //display your alert view }
不要忘记把它挂在IB
+0
但是,我怎么知道用户何时按下了添加(+)按钮? – ivantxo 2012-03-27 10:00:53
1
使用以下代码,
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonActionName)];
它会在导航栏的右上角显示+
按钮。
-(void) addButtonActionName {
// Your code for the Alert view
}
0
下面是在导航添加BarButton酒吧
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(ShowMyAlert:)];
&这是为事件处理代码...
- (void)ShowMyAlert:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Test Alert Message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
你必须加写btn行动方法 – 2012-03-27 10:00:04