添加常用的插件

//    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);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值