#import <UIKit/UIKit.h>
@interface UIAlertView (extended)
- (void) dismiss;
@end
@interface HelloController : UIViewController <UIAlertViewDelegate>
{
UIAlertView *baseAlert;
}
@end
@implementation HelloController
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
printf("User Pressed Button %d\n", buttonIndex + 1);
[alertView release];
}
- (void) performDismiss: (NSTimer *)timer
{
[baseAlert dismissWithClickedButtonIndex:0 animated:NO];
[baseAlert release];
baseAlert = NULL;
}
- (void) presentSheet
{
baseAlert = [[UIAlertView alloc]
initWithTitle:@"Alert" message:@"\nMessage to user with asynchronous information"
delegate:self cancelButtonTitle:nil
otherButtonTitles: nil];
[NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector: @selector(performDismiss:)
userInfo:nil repeats:NO];
[baseAlert show];
}
- (id) init
{
if (self = [super init]) self.title = @"Hello World";
return self;
}
- (void)loadView
{
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.view = contentView;
contentView.backgroundColor = [UIColor whiteColor];
[contentView release];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
initWithTitle:@"Do It"
style:UIBarButtonItemStylePlain
target:self
action:@selector(presentSheet)] autorelease];
}
@end
@interface SampleAppDelegate : NSObject <UIApplicationDelegate>
@end
@implementation SampleAppDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[HelloController alloc] init]];
[window addSubview:nav.view];
[window makeKeyAndVisible];
}
@end
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"SampleAppDelegate");
[pool release];
return retVal;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
02a - TimedAlert.zip (19个子文件)
02a - TimedAlert
Icon.png 6KB
.DS_Store 6KB
Info.plist 788B
main.m 2KB
helloworld.png 18KB
Timed.mov 370KB
Default.png 18KB
HelloWorld_Prefix.pch 189B
HelloWorld.xcodeproj
ericasadun.mode1v3 39KB
project.xcworkspace
contents.xcworkspacedata 155B
xcuserdata
donny.xcuserdatad
UserInterfaceState.xcuserstate 13KB
yile.perspectivev3 41KB
cclv.pbxuser 2KB
yile.pbxuser 4KB
ericasadun.pbxuser 7KB
xcuserdata
donny.xcuserdatad
xcschemes
xcschememanagement.plist 482B
HelloWorld.xcscheme 3KB
cclv.perspectivev3 42KB
project.pbxproj 10KB
共 19 条
- 1
Donny_zhang
- 粉丝: 61
- 资源: 38
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页