大佬教程收集整理的这篇文章主要介绍了iphone – 在NSObject类中显示UIAlertView,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
登录系统将显示UIAlertView,当点击“OK”时,系统将尝试登录.我可以调用该类,UIAlertView将显示,但我无法分辨哪些按钮被点击.这是我的代码:
//Calling the login system Login *login = [[Login alloc] init];
Login.h:
#import <Foundation/Foundation.h> @interface Login : NSObject <UIAlertViewDelegate> { } @end
Login.m:
#import "Login.h" @implementation Login +(void)initialize { UIAlertView *alert = [[UIAlertView alloc] initWithtitle:@"Login" message:nil delegate:self cancelButtontitle:@"Cancel" otherButtontitles:@"OK",nil]; [alert show]; [alert release]; NSLog(@"TesTing"); } - (void)alertView:(UIAlertView *)alertView clickedButtonATindex:(NSInteger)buttonIndex { NSLog(@"Here"); NSString *title = [alertView buttontitleATindex:buttonIndex]; if([title isEqualToString:@"OK"]) { NSLog(@"Tapped"); } } @end
现在,在我将uITextField放入视图之前,我只想让应用知道哪个按钮被点击了.测试显示在日志中,但不显示此处或Tapped.谢谢!
以上是大佬教程为你收集整理的iphone – 在NSObject类中显示UIAlertView全部内容,希望文章能够帮你解决iphone – 在NSObject类中显示UIAlertView所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。