我有一個uialertview內insertnewobject函數如下所示。UIAlertView委託裏面insertnewObject
- (void)insertNewObject:(UIButton *)sender
{
//NSLog(@"Hello");
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Add Reference"
message:@"Enter Reference Manually"
delegate:nil
cancelButtonTitle:@"Insert Manually"
otherButtonTitles:nil];
[message addButtonWithTitle:@"Enter ISBN"];
[message addButtonWithTitle:@"Enter DOI"];
[message show];
}
我可以看到UIAlertView。但是這個功能根本沒有達到!
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"Hello");
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Enter ISBN"])
{
NSLog(@"Button 1 was selected.");
}
else if([title isEqualToString:@"Enter DOI"])
{
NSLog(@"Button 2 was selected.");
}
else if([title isEqualToString:@"Insert Manually"])
{
NSLog(@"Button 3 was selected.");
}
}
請讓我知道我哪裏去錯了!
謝謝你得到它的工作! – bharath
太棒了!如果這是你正在看的答案,那麼接受答案:) – aToz