一些常用的小控件的整理

1.时间控制器   但是需要注意只能在主线程中使用 

[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(logBtnClick) userInfo:nil repeats:YES];

2.延迟调用

[self performSelector:@selector(logBtnClick) withObject:self afterDelay:1];

3.直接给睡10秒钟再说

[NSThread sleepForTimeInterval:10.0];

 

4.UIAlertView 这个控件是有代理函数的  UIAlertViewDelegate   但是只需要在头部引用就可以了   而不需要像大部分代理一样去特定遵守

   UIAlertView *av=[[UIAlertView alloc]initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"确定" otherButtonTitles:@"返回", nil];

    [av show];

他的代理函数作用就是实现弹出各个按钮的点击事件

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

    switch (buttonIndex) {

        case 0:

            NSLog(@"点击确定了");

            break;

        default:

            NSLog(@"点击返回了");

            break;

    }

}

 

posted @ 2015-06-24 09:09  江南花印孓  阅读(92)  评论(0编辑  收藏  举报