Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90802
  • 博文数量: 22
  • 博客积分: 486
  • 博客等级: 下士
  • 技术积分: 262
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-07 19:26
文章分类

全部博文(22)

文章存档

2012年(22)

我的朋友

分类: 嵌入式

2012-07-19 14:53:04


点击(此处)折叠或打开

  1. /***********UIButton***************/
  2. //新建button UIButtonTypeCustom为隐藏按键 UIButtonTypeRoundedRect 为显示
  3.  UIButton * testbutton = [UIButton buttonWithType:UIButtonTypeCustom];

  4. //设置button的文字显示
  5.  [testbutton setTitle:@"显示" forState:UIControlStateNormal];

  6. //为按键添加事件
  7.  [testbutton addTarget:self action:@selector(exitselview:) forControlEvents:UIControlEventTouchUpInside];



  8. //如果一次需要设多个button可用for 循环创建.........可给相应的button设一个tag值。方便事件调用的时候用。
  9. testbutton.tag = 0;

  10. //在事件中可与相应的button 关联 判断
  11. if( ((UIButton*)sender).tag ==N)
  12. {
  13.      ......
  14. }
  15. else
  16. {
  17.     .......
  18. }

  19.  
  20.  

  21.  
  22. /*********NSMutableArray **********/
  23. //新建array
  24. NSMutableArray *testArray = [NSMutableArray arrayWithObjects:@"111111",@"22222",@"3333",@"4444",nil];

  25. //取具体的某一个
  26. [testArray objectAtIndex:0]

  27.  

  28.  //计数器
  29. UIScrollView * testview1 = [[UIScrollView alloc]init];
  30. //alloc 后。计数器就为1
  31. NSLog(@"retainCount1:%d",[testview1 retainCount]);
  32.     
  33. //计数器会加1
  34. [testview1 retain];
  35.  NSLog(@"retainCount2:%d",[testview1 retainCount]);
  36.     
  37. //release 后。计数器减1 。当计数器为0时。系统才释放
  38. [testview1 release];
  39. NSLog(@"retainCount3:%d",[testview1 retainCount]);

阅读(260) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~