- 博客(35)
- 收藏
- 关注
翻译 Block的使用(一)基本语法
1。 Block用法: 一般是用来表示、简化一小段的程式码,它特别适合用来建立一些同步执行的程式片段、封装一些小型的工作或是用来做为某一个工作完成时的回传呼叫(callback) 。2。作为独立的代码块使用 returnType ( ^blockName ) (paramType1, paramType2) = ^ (paramType1 pa
2013-12-18 11:10:26 564
翻译 GCD-queue介绍
三种queue类型 Main queue : 主队列执行主线程,调用所有与UI相关的方法,使用dispatch_get_main_queue函数检索句柄主队列 Concurrent queues : 并发队列,执行异步或同步任务。使用dispatch_get_global_queue函数检索句柄并发队列。 Serial queues : 连续串行队列,不在
2013-12-17 15:43:37 781
翻译 Storyboard-segue的使用
1。嵌入Navigation Controller :Editor -> Embed in -> Navigation Controller2。在IB上创建segue,并设置id3。传递数据 - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender //是否执行segu
2013-12-17 11:28:49 1433
翻译 UICollectionViewCell上显示编辑菜单
1。显示编辑菜单(如复制,粘贴等) - (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath //是否显示菜单 - (BOOL)collectionView:(UICollectionView *)collectio
2013-12-16 17:07:24 5055
翻译 UICollectionView-添加自定义交互(如手势等)
1。相关方法 - (void)invalidateLayout // 刷新布局e.g. - (void) handlePinches:(UIPinchGestureRecognizer *)paramSender{ CGSize DefaultLayoutItemSize = CGSizeMake(80.0f, 120.0f); //这是原先设置的默认的尺寸大
2013-12-16 16:24:02 3562 1
翻译 UICollectionView的HeaderView、FooterView
1。相关方法 - (void)registerNib:(UINib *)nib forSupplementaryViewOfKind:(NSString *)kind withReuseIdentifier:(NSString *)identifier //注册xib,以便后续重用 - (UICollectionReusableView *)collectionVie
2013-12-16 15:13:17 9615
翻译 UICollectionView-事件
1。UICollectionViewCell状态 highlighted:手指按下没抬起来 selected:手指按下,之后抬起来 selectedBackgroundView:选中背景2。 事件 - (void)collectionView:(UICollectionView *)collectionView di
2013-12-16 10:51:10 3098
翻译 UICollectionView-数据源
1。 数据源 - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView //有多少个section,默认为1 - (NSInteger)collectionView:(UICollectionView *)collectionView nu
2013-12-13 16:40:18 1759
翻译 UICollectionView-布局
1。类似UITableView,不同之处:可多列(以二维方式存在)2。 布局方式 minimumLineSpacing:最小行间距,CGFloat minimumInteritemSpacing:最小项间距(单元格之间的空隙),CGFloat itemSize:每个单元格尺寸大小,CGSize scrollDi
2013-12-13 16:37:07 1084
翻译 UITableViewController中的刷新控件(UIRefreshControl)
1。位于table view的顶端,下拉可刷新。只能是在UITableViewController里可用2。初始化 self.refreshControl = [[UIRefreshControl alloc] init]; [self.refreshControl addTarget:self action:@selector(ha
2013-12-11 17:55:59 1705
翻译 在表中移动,删除 row,section
1。位置索引:base_index = 0 2。UITableView.h 针对表进行删除或移动 rows / sections操作 - (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath //移动row - (void
2013-12-11 15:52:09 1158
翻译 在表的单元格上显示编辑菜单
1。编辑菜单:包含剪切,复制,粘贴。。。等2。 //长按某行时,是否显示编辑菜单 - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath //当可显示编辑菜单时,哪些操作选项可显示 - (BOO
2013-12-11 11:25:02 634
翻译 创建表的页眉,页脚(Header and Footer)
1。一个表可以有多个section,每个section都可以各有一个header and footer2。 可自定义视图内容(包括文本,图像等)作为页眉,页脚 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section //页眉视图 tabl
2013-12-10 17:27:10 1426
翻译 从表里删除行
e.g. //设置表的编辑模式,如insertion , deletion , both or neither - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ return
2013-12-10 15:30:00 586
翻译 自定义accessoryView of UITableViewCell及访问事件
1。在cell中添加按钮作为accessoryView 当只有一个section时,可在设置cell内容时,单独设置cell中button的tag=cell_index,在后续可通过获取button的tag得知其所属cell; 当有多个section时,可通过循环获取button的父视图,直至取到其所属cell e.g. - (UITable
2013-12-10 13:48:25 999
翻译 UITableView
1。初始化 initWithFrame:style: e.g. [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; //可充满整个视图2。 //事件 myTableView.delegate = sel
2013-12-10 11:23:25 812
翻译 UIDynamicItemBehavior-动画效果:增加各种物理特性
1。可给活动项指派不同的物理特性 - (instancetype)initWithItems:(NSArray *)items //初始化2。属性 allowsRotation resistance: 抗阻力 0~CGFLOAT_MAX ,阻碍原有所加注的行为(如本来是重力自由落体行为,则阻碍其下落,阻碍程度根据其值来决定) frictio
2013-12-06 17:51:45 4271
翻译 UISnapBehavior-动画效果:迅猛移动弹跳摆动
1。与之前的UIPushBehavior不同,之前的Push只是中规中矩的移动 而这个SnapBehavior带来的移动视觉效果更强烈 - (instancetype)initWithItem:(id)item snapToPoint:(CGPoint)point //初始化 damping //CGFloat ,迅猛度,[0,1]默认0.5
2013-12-06 17:10:37 3876
翻译 UIAttachmentBehavior-动画效果:依附,关联
1。关联动画项,使其中一个运动后,相关联的对象也随之一起运动2。初始化 - (instancetype)initWithItem:(id)item attachedToAnchor:(CGPoint)point - (instancetype)initWithItem:(id)item offsetFromCenter:(UIOffset)p1 attac
2013-12-06 16:05:45 5162
翻译 UIPushBehavior-动画效果:推移行为
1。从一点移到另一点2。相关属性 mode : UIPushBehaviorModeContinuous //推移模式 angle : setAngle //推移角度 magnitude : setMagnitude //速度 每1个magnigude将会引起100/平方秒的加速度 e.g. p1 :
2013-12-06 13:31:55 4469
翻译 UICollisionBehavior-动画效果:碰撞
1。碰撞 需要确定边界线,使 增加了各动画行为(UIDynamicBehavior)的视图 在执行动画过程中 不能越界 translateReferenceBoundsIntoBoundary : YES (将参照视图的边界作为碰撞行为的侦测边界,即在参照视图中所有已增加了collisionBehavior的项在执行动画效果时,均
2013-12-04 17:51:30 2787
翻译 UIGravityBehavior-动画效果:重力自由落体
1。重力行为2。UIDynamicAnimator 初始化:- (instancetype) initWithReferenceView : (UIView *) view ;3。UIGravityBehavior 初始化:- (instancetype) initWithItems : (NSArray *) items ;4。ad
2013-12-04 15:46:54 4107
翻译 UIDynamicBehavior and UIDynamicAnimator 简介
1。attach behaviors to an animator behaviors :UIDynamicBehavior -UICollisionBehavior , UIGravityBehavior , UISnapBehavior , UIPushBehavior animator : UIDynamicAnimator -needs t
2013-12-04 15:18:03 1335
翻译 UIPageViewController
1。具有翻页效果的分页控制器2。 - (void) pageViewController : (UIPageViewController *) pageViewController didFinishAnimating : (BOOL) finished previousViewControllers : (NSArray *) previousViewControl
2013-12-04 11:35:13 1318
翻译 styled Texts
1。mixed-style strings in on line of text2。NSAttributedString / NSMutableAttributedString 3。相关属性,方法 - (id) initWithString : (NSString *) aString ; //初始化 NSMutableAttributedString
2013-12-03 17:27:30 565
翻译 UIProgressView
1。progress bar : 可描绘任务进度2。初始化: - (id) initWithProgressViewStyle : (UIProgressViewStyle) style ; // UIProgressViewStyleDefault / UIProgressViewStyleBar (Bar mode 可放在 tool b
2013-12-03 16:39:57 510
翻译 UIWebView
1。load web content2。load method - (void) loadHTMLString : baseURL : // e.g. …. loadData : MIMEType : textEncodingName : baseURL // loads NSData loadReq
2013-12-03 15:54:40 493
翻译 UIScrollView
1。contentSize : type of CGSize,实际内容的尺寸 - (void) addSubview : (UIView *) view 当contentSize超过frame时,才会滚动2。 - (void) scrollViewDidScroll : (UIScrollView *) sc
2013-12-03 15:17:04 558
翻译 UIImageView
1。初始化: - (id) initWithFrame : (CGRect) aRect2。相关属性: contentMode UIViewContentModeScaleToFill : image 将最大限度的填满imageView的空间,image会变形 U
2013-12-03 10:49:40 629
翻译 UIButton
1。高度: 在ios7中,默认的高度是442。初始化: + (id) buttonWithType : (UIButtonType) buttonType UIButtonType : UIButtonTypeCustom 默认 when render an image
2013-12-02 17:06:32 489
翻译 UITextView
1。 multiple lines , contain scrollable content2。相关属性: contentInset : UIEdgeInsetsMake ( top , left , bottom , right ) //实际内容距上,左,下,右四个方向的边界的距离 margins3。相关的键盘监听:
2013-12-02 16:27:42 527
翻译 UITextField
1。文本框高度: 默认是31,在IB中无法更改,但是用代码创建的text field 可以更改高度2。相关属性: borderStyle ( UITextBorderStyleRoundedRect , 。。。) contentVerticalAlignment ( UIControlConte
2013-12-02 15:30:38 581
翻译 UILabel
1。初始化: - (id) initWithFrame : (CGRect) aRect ; //默认内容超过宽度时,会自动被截断,以省略号显示在末尾2。属性: text , font , center numberOfLines : 行数 (default : 1 ) lineBreakMode : NSLineBreakB
2013-12-02 13:51:54 590
翻译 UITabBarController
1。a container controller each tab bar item : can be a navigation controller / a view controller2。属性: viewControllers tabBarItem : text, an image ( 24*24 / @2x:
2013-12-02 10:56:05 486
翻译 NavigationBar ( with buttons )
1。按钮项:UIBarButtonItem of NavigationItem : rightBarButtonItem / leftBarButtonItem2。初始化:- (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action
2013-12-02 10:25:40 671
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人