IPHONE note

本文介绍了如何在 iOS 开发中使用 UITableView 进行自定义选中效果、背景颜色设置及添加图片背景的方法。此外还提供了生成随机数的示例代码,并探讨了 UIView 动画过渡效果以及 CALayer 的 Action 执行机制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

TableViewController:

  1 disable selected: willSelectedRowAtIndex:(NSIndexPath *)index{ return nil; }
   2 TableView can custom it's title foot
   3 Adding float title effect: titleForHeaderInSection:(NSInteger)section{return "ss"};

Favoriate background color
   [UIColor colorWithRed:197.0/255.0 green:204.0/255.0 blue:211.0/255.0 alpha:1.0];

Generate random number
  1. // Get random number between 0 and 500
  2. int x = arc4random ( ) % 100 ;
  3. // Get random number between 500 and 1000
  4. int y =   ( arc4random ( ) % 501 ) + 500 ) ;
  5. //Get random number among a specify number
  6. (rand()%6)+1
View animation transation:
UIViewAnimationTransitionNone, UIViewAnimationTransitionFlipFromLeft, UIViewAnimationTransitionFlipFromRight UIViewAnimationTransitionCurlU, UIViewAnimationTransitionCurlDown

Animation Transaction: animation同样支持事务,让一群Animation一起提交

Action:
   一个Layer管理很多Action,每个Action有一个key layer.actions=actions(NSMutableDirectory)
   Layer执行Action: actionForLayer:forKey.方法
   Layer在几种情况下会触发Action, 1 被插入一个Layer-Tree, 2被remove一个Layer-Tree 3被replace一个Layer
  每个CAAction实现runActionForKey方法,在其中定义Animation, 可以实现actionForKey返回一个CAAnimation来指定默认的implite animation


Add Image for view background
    UIView doesn't support add image to background. The solution is add an ImageView to surface of UIView. And allow user can interaction with its subviews
    [imageView setUserInteractionEnabled:YES]



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值