生命周期我们建立一个简单的模型来测试生命周期:新建两个ViewController,一个是主视图控制器(main ViewController,以下简称mainVC),一个是副视图控制器(sub ViewController,以下简称subVC),在mainVC里点击一个Button,以modal方...
分类:
其他好文 时间:
2014-12-05 12:18:39
阅读次数:
184
没用IB有一段时间了,程序这东西经常写与用就会忘记 话说IB与Viewcontroller关联也不能,但是开始就错了。导致一直crash,真是对Xcode说我跟你有什么仇,跟你有什么怨。 IB与ViewController关联就简单几步: 1、(首先创建一个空的XIB文件,与一个UIVie...
分类:
移动开发 时间:
2014-12-04 21:26:38
阅读次数:
182
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; NSLog(@"s...
分类:
其他好文 时间:
2014-12-04 17:13:35
阅读次数:
263
1.主控制器: 1 // 2 // ViewController.m 3 // GroupPurchase 4 // 5 // Created by hellovoidworld on 14/12/3. 6 // Copyright (c) 2014年 hellovoidworld. All rig...
分类:
移动开发 时间:
2014-12-04 06:16:53
阅读次数:
256
最近在学习ios抓取网页内容时遇到各种重复代码的问题,看着这么多重复的代码,感觉实在不爽,于是学习了ios的protocol。
在我看来这个protocol其实应该是Java中的interface。
也就是定义一个协议(或者叫接口),定义一堆方法,让实现了该方法的类的实例传入即可。
在我的工程中,抓取不同网页的viewcontroller,获取网页的代码完全是一模一样的,除了网址不同以外,别无二致,所以这一部分提取出来作为一个类,专门实现上网取数据,数据取到了需要通知viewcontroller,这时就需...
分类:
移动开发 时间:
2014-12-03 21:19:58
阅读次数:
174
本文转载至 http://www.cocoachina.com/ios/20141128/10356.html随着程序逻辑复杂度的提高,你是否也发现了App中一些ViewController的代码行数急剧增多,达到了2、3千行,甚至更多。这时如果想再添加一点功能或者修改现有逻辑变得让人无比头疼。如果...
分类:
其他好文 时间:
2014-12-03 00:23:36
阅读次数:
150
#import @interface ViewController : UITableViewController@property (weak, nonatomic) IBOutlet UILabel *Label1;- (IBAction)onClick:(id)sender;@end为了将事件...
分类:
其他好文 时间:
2014-12-02 20:36:08
阅读次数:
185
选择菜单栏中得File|New|File...命令,选择Property List,创建一个1.plist文件在桌面
核心代码:
#import
@interface ViewController : UIViewController{
NSDictionary *list;
NSArray *a;
}
@end
#import "ViewController....
分类:
移动开发 时间:
2014-12-01 19:20:34
阅读次数:
201
直接上代买吧:
@implementation ViewController
- (void)viewDidLoad {
a = [NSArray arrayWithObjects:@"ant",@"alpaca",@"albatross", nil];
b = [NSArray arrayWithObjects:@"badger",@"bat",@"bear", nil];
...
分类:
移动开发 时间:
2014-12-01 17:36:24
阅读次数:
148
iOS UICollectionView手写代码实现步骤
//
// ViewController.h
// collectionView手写代码
//
// Created by yangxiuying on 14/11/28.
// Copyright (c) 2014年 lanjiying. All rights reserved.
//
#import ...
分类:
移动开发 时间:
2014-12-01 11:26:36
阅读次数:
233