显示下一条  |  关闭

逝去的时光

每天我要进步许多

 
 
 
 

自定义模块

 
 
模块内容加载中...
 
 
 
 
 

日历

 
 
模块内容加载中...
 
 
 
 
 

天气

 
 
模块内容加载中...
 
 
 
 
 
 
 

上海市 长宁区

 发消息  写留言

 
博客等级加载中...
今日访问加载中...
总访问量加载中...
最后登录加载中...
 
 
 
 
 
 
 
心情随笔列表加载中...
 
 
 
 
 
 
 
模块内容加载中...
 
 
 
 
 
 
 
日志评论
评论列表加载中...
 
 
 
 
 
 
 
 

如何在IB中添加一个controller

2012-5-8 18:56:09 阅读1 评论0 82012/05 May8

之前在寻找如何在一个view中添加多个tableview作为subview,得到的一种方法是,每个tableview仍旧对应一个tableview controller,然后将它自身添加为subview
在IB中是这么做的

Added two UITableViewController subclasses to the project. (These are trivial and just create NSArray instances containing the strings that are the contents of their tableview rows.) 

In the viewcontroller.xib file added two tableview controllers from the Library and set the Class Identity of these to the UITableViewController subclasses I just created in the project. 

Dragged the tableviews from these two view controllers into the main view and set their size, position and autoresizing properties. 

Unchecked the 'Autoresize View To Fill Screen' checkbox for the controllers.

Added two UITableViewController IBOutlets to the Main View controller's header and hooked these up in IB. This step is critical, although I don't know why. The controllers seem to be built even if these outlets don't exist but the table views don't appear if they don't exist. 

Also had to set the view outlet for the table view controllers in IB back to the two table views that are now inside the main view. 

It is necessary to check all the connections in IB very carefully. Use the list view mode. Control click on all the objects and inspect the little window that appears showing the outlet connections to see that everything is correct.

简单来讲
  1. 在IB从Library拖拽一个controller,将这个controller设为你自己的继续的具体类
  2. 从controller中将view拖出,拖到你自己的view作为subview
  3. 设置controller的一些属性,比如去掉Fill Screen的选项
  4. 将controller作为一个IBOutlet,不然这个subview不会显示

作者  | 2012-5-8 18:56:09 | 阅读(1) |评论(0) | 阅读全文>>

UIViewController中处理方向变化

2012-5-4 15:59:17 阅读4 评论0 42012/05 May4

参考http://www.dizzey.com/development/ios/handling-layout-on-uiinterfaceorientation-change/
这个是由view controler来相应orientation变化的

待续: view本身呢?

作者  | 2012-5-4 15:59:17 | 阅读(4) |评论(0) | 阅读全文>>

讲UIView contentStrectch的好文章

2012-5-3 17:56:03 阅读2 评论0 32012/05 May3

参考: http://j0ris.tumblr.com/

对应一个给定的contentStrectch (即一个矩形)
讲UIView contentStrectch的好文章 - neverland - 逝去的时光
它确定了下面的可拉伸区域
讲UIView contentStrectch的好文章 - neverland - 逝去的时光

 然后边上的四个角是不可拉伸的
讲UIView contentStrectch的好文章 - neverland - 逝去的时光
 

 

作者  | 2012-5-3 17:56:03 | 阅读(2) |评论(0) | 阅读全文>>

CGContextClip

2012-4-26 16:02:07 阅读7 评论0 262012/04 Apr26

参考: http://mobile.51cto.com/iphone-280478.htm

CGContextRef ctx = UIGraphicsGetCurrentContext();

    CGFloat cornerRadius = 6.;

    CGContextSaveGState(ctx);

    UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect:[self bounds

                                                           cornerRadius:cornerRadius];

    CGContextAddPath(ctx, [roundedPath CGPath]);

    CGContextRestoreGState(ctx);

    CGContextClip(ctx);

先创建一个路径,然后根据这个路径创建了一个剪辑区域,接下来所有的绘制都会被限制在这个区域内,绘制在区域外的会不可见

作者  | 2012-4-26 16:02:07 | 阅读(7) |评论(0) | 阅读全文>>

Ios 遇到的问题

2012-4-6 11:18:53 阅读10 评论0 62012/04 Apr6

  1. viewWillAppear wiiAnimateToInterfaceOrientation没有被调用
    当一个view controller不是位于栈顶时,比如只是将自己的view加入到另外一个controller的view中 (另外一个典型的应用是push到navigation Controller)。 这时候这些函数就不会被调用,除非你在另外一个controller的viewDidAppear函数中,显示的调用
    参考http://stackoverflow.com/questions/3595471/willanimaterotationtointerfaceorientation-not-called-on-popviewcontrolleranimate

作者  | 2012-4-6 11:18:53 | 阅读(10) |评论(0) | 阅读全文>>

查看所有日志>>

 
 
 
 
 
 我要留言
 
 
 
留言列表加载中...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2012

   
创建博客 登录  
 关注