标签:des c style class blog code
iOS开发UI篇—直接使用UITableView Controller
一、一般过程
1 // 2 // YYViewController.h 3 // UITableView Controller 4 // 5 // Created by 孔医己 on 14-6-2. 6 // Copyright (c) 2014年 itcast. All rights reserved. 7 // 8 9 #import <UIKit/UIKit.h> 10 11 @interface YYViewController : UIViewController 12 13 @end
系统storyboard中默认的控制器为:ViewController
这样的话如果整个程序界面都只是使用UITableView来搭建,那么一般需要完成以下相对繁琐的步骤:
(1)向界面上拖一个UItableview
(2)设置数据源
(3)设置代理
(4)遵守代理协议
1 // 2 // YYViewController.h 3 // UITableView Controller 4 // 5 // Created by 孔医己 on 14-6-2. 6 // Copyright (c) 2014年 itcast. All rights reserved. 7 // 8 9 #import <UIKit/UIKit.h> 10 11 @interface YYViewController : UITableViewController 12 13 @end
1 // UITableViewController.h 2 // UIKit 3 // 4 // Copyright (c) 2008-2013, Apple Inc. All rights reserved. 5 // 6 #import <Foundation/Foundation.h> 7 #import <UIKit/UIViewController.h> 8 #import <UIKit/UITableView.h> 9 #import <UIKit/UIKitDefines.h> 10 11 // Creates a table view with the correct dimensions and autoresizing, setting the datasource and delegate to self. 12 // In -viewWillAppear:, it reloads the table‘s data if it‘s empty. Otherwise, it deselects all rows (with or without animation) if clearsSelectionOnViewWillAppear is YES. 13 // In -viewDidAppear:, it flashes the table‘s scroll indicators. 14 // Implements -setEditing:animated: to toggle the editing state of the table. 15 16 NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 17 18 - (id)initWithStyle:(UITableViewStyle)style; 19 20 @property(nonatomic,retain) UITableView *tableView; 21 @property(nonatomic) BOOL clearsSelectionOnViewWillAppear NS_AVAILABLE_IOS(3_2); // defaults to YES. If YES, any selection is cleared in viewWillAppear: 22 23 @property (nonatomic,retain) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(6_0); 24 25 @end
iOS开发UI篇—直接使用UITableView Controller,布布扣,bubuko.com
iOS开发UI篇—直接使用UITableView Controller
标签:des c style class blog code
原文地址:http://www.cnblogs.com/wendingding/p/3764754.html