• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

objective-c常用的一些控件。

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
/***********UIButton***************/
//新建button  UIButtonTypeCustom为隐藏按键  UIButtonTypeRoundedRect 为显示
 UIButton * testbutton = [UIButton buttonWithType:UIButtonTypeCustom];

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

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

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

//在事件中可与相应的button 关联 判断
if( ((UIButton*)sender).tag ==N)
{
     ......
}
else
{
    .......
}

 

 

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

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

 

 //计数器
UIScrollView * testview1 = [[UIScrollView alloc]init];
//alloc 后。计数器就为1
NSLog(@"retainCount1:%d",[testview1 retainCount]);
    
//计数器会加1
[testview1 retain];
 NSLog(@"retainCount2:%d",[testview1 retainCount]);
    
//release 后。计数器减1 。当计数器为0时。系统才释放
[testview1 release];
NSLog(@"retainCount3:%d",[testview1 retainCount]);

 

//当动画停止的时候,调用hideAnimationStopped事件
 [UIView setAnimationDidStopSelector:@selector(hideAnimationStopped)];

 

 
//opacity 实现视图的淡入淡出效果
CABasicAnimation *testAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
    //后面的值为0~1 表示当前视图的透明度。
testAnimation.fromValue = [NSNumber numberWithFloat:1];
    //当值为正数时 表示淡入。。当为负数时表示淡出。相当于退出慢慢谈出
testAnimation.toValue =[NSNumber numberWithFloat:-0.5];
testAnimation.duration = 3.0;

 

 

//CABasicAnimation   当动画停止时。触发事件

-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
    [self tooverview];
}

 

qingjoin


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
WindowsObjectiveC编译环境搭建发布时间:2022-07-12
下一篇:
如何制作Objective-C的UML图[1]发布时间:2022-07-12
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap