对于很多初学者来说,肯定希望自己尝试不用傻瓜的“Single View Application”模板创建一个含有View的窗口,而是希望能从零开始,先建一个空的框架,然后逐渐向里面添加View。但遗憾的是 XCODE4.6既没有在开始向导中包含4.0版本的“Window-Based Application”选项,也没有直接添加UIViewController subclass模板的选项,所以在很多...
分类:
移动开发 时间:
2014-09-30 09:59:52
阅读次数:
253
一千个人眼里有一千个哈姆雷特, 如果不统一下, 每个程序员按照自己的习惯的代码风格去写, 会给维护造成了困扰,所以我们给UIViewController的申明周期中加上一些方法来规范下...
分类:
其他好文 时间:
2014-09-29 18:56:31
阅读次数:
221
如果要和UIActionSheet对象交互,那么UIViewController类的h文件需要遵循UIActionSheetDelegate协议。示例代码:
@interface BIDViewController : UIViewController
并且,需要在UIViewController类的m文件中构造一个UIActionSheet对象,同时实现协议的方法。示例代码:
- (IBAction)buttonPressed:(id)sender {
...
分类:
移动开发 时间:
2014-09-27 18:50:00
阅读次数:
185
import UIKitclass ViewController: UIViewController , UIAlertViewDelegate { @IBOutlet var label: UILabel? @IBOutlet var btn: UIButton? @I...
分类:
移动开发 时间:
2014-09-27 02:05:48
阅读次数:
146
import UIKitclass ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {@IBOutlet var myTable: UITableView?var typeArray:NSArr...
分类:
移动开发 时间:
2014-09-26 23:02:38
阅读次数:
239
Layout SupportThis protocol is implemented by the UIViewController properties topLayoutGuide and bottomLayoutGuide to support using Auto Layout with a...
分类:
其他好文 时间:
2014-09-26 12:46:58
阅读次数:
174
标题中所说的方法,都是UIViewController的方法,跟UIViewController的view属性的生命周期息息相关loadView方法1. 什么时候被调用:每次访问UIViewController的view(比如controller.view、self.view)而且view为nil,...
分类:
其他好文 时间:
2014-09-25 19:14:47
阅读次数:
406
直接上代码,说明请看注释吧
ViewController.h
#import
@interface ViewController : UIViewController{
}
@property (strong, nonatomic)UICollectionView *collectionView;
@end
ViewController.m
#import "ViewControl...
分类:
其他好文 时间:
2014-09-25 16:13:19
阅读次数:
222
使用第三方:QuiltView(可在cocoapods上找到).h文件#import<UIKit/UIKit.h>
#import"TMQuiltView.h"
#import"TMPhotoQuiltViewCell.h"
@interfaceSelfHomeViewController:UIViewController<TMQuiltViewDataSource,TMQuiltViewDelegate>{
}
@property(strong,nonat..
分类:
其他好文 时间:
2014-09-25 13:19:49
阅读次数:
220
在iOS 5.0以前,我们在一个UIViewController中这样组织相关的UIView在以前,一个UIViewController的View可能有很多小的子view。这些子view很多时候被盖在最后,我们在最外层ViewController的viewDidLoad方法中,用addSubview...
分类:
移动开发 时间:
2014-09-23 18:33:35
阅读次数:
152