// UIPageControl *pageControl = [[UIPageControl alloc]initWithFrame:CGRectMake(0, 100, 320, 40)];
// //十个小圆圈
// pageControl.numberOfPages = 1;
// //当前是第二页
// //pageControl.currentPage = 2;
// //不响应事件
// //pageControl.enabled = NO;
// //隐藏UIControl
// pageControl.hidesForSinglePage = YES;
// [pageControl addTarget:self action:@selector(change:) forControlEvents:UIControlEventValueChanged];
// pageControl.backgroundColor = [UIColor redColor];
// [self.window addSubview:pageControl];
// [pageControl release];
//初始化一个风火轮
// UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// //设置位置
// activityView.center = CGPointMake(160, 200);
// //开始转动 默认是静止状态
// [activityView startAnimating];
// //静止的时候不隐藏
// // activityView.hidesWhenStopped = NO;
// [self.window addSubview:activityView];
// [activityView release];
// // 添加动作
// [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(test:) userInfo:activityView repeats:NO];
// //导航栏上的风火轮
// [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
//创建两个button
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = CGRectMake(10, 160, 100, 30);
[button1 setTitle:@"警告框" forState:UIControlStateNormal];
[button1 addTarget:self action:@selector(showAlertView) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:button1];
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button2.frame = CGRectMake(210, 160, 100, 30);
[button2 setTitle:@"Action" forState:UIControlStateNormal];
[button2 addTarget:self action:@selector(showActionSheet) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:button2];
[self.window makeKeyAndVisible];
return YES;
}
//显示当前页码数
//- (void)change:(UIPageControl *)pageControl
//{
// NSLog(@"%d",pageControl.currentPage);
//}
//- (void)test:(NSTimer *)timer
//{
// [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
// UIActivityIndicatorView *activityView = [timer userInfo];
// [activityView stopAnimating];
//}
int identifier = 1;
- (void)showAlertView
{
//创建一个警告框
alertView *pAlertView = [[[alertView alloc]initWithTitle:@"title" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"other", nil]autorelease];
pAlertView.tag = identifier;
//警告框转
[pAlertView show];
identifier ++;
}
- (void) showActionSheet
{
UIActionSheet *actionSheet = [[[UIActionSheet alloc]initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"destructive" otherButtonTitles:@"other1",@"other2",@"other3", nil]autorelease];
[actionSheet showInView:self.window];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"buttonIndex %d",buttonIndex);
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"buttonIndex %d",buttonIndex);
}