Three20 learning to use TTableViewController to implement a simple setting Interface

Source: Internet
Author: User

Three20 provides better encapsulation for TableViewController, making the interface for implementing the List class simpler. Now we use TTTableViewController to implement a simple setting interface. Create a project and import the Three20 library. Create a new class SettingsViewController inherited from TTTableViewContoller, and initialize and set table data in the-(id) initWithNibName :( NSString *) nibNameOrNil bundle :( NSBundle *) nibBundleOrNil method: [cpp]-(id) initWithNibName :( NSString *) nibNameOrNil bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization self. title = @ "set"; self. tableViewStyle = UIT AbleViewStyleGrouped; TTTableButton * userButton = [[TTTableButton alloc] init]; userButton. text = @ "deregister cloay"; userButton. delegate = self; userButton. selector = @ selector (actionLoginOut); self. dataSource = [TTSectionedDataSource performancewithobjects: @ "account settings", userButton, @ "Network Settings", [TTTableControlItem itemWithCaption: @ "load images only in wifi network" control: [[UISwitch alloc] init], @ "rating", [TTTableButton itemWith Text: @ "Give us a score, comment" delegate: self selector: @ selector (pingjia)], [TTTableButton itemWithText: @ "feedback" delegate: self selector: @ selector (feedback)], nil];} return self;}-(id) initWithNibName :( NSString *) nibNameOrNil bundle :( NSBundle *) nibBundleOrNil {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization self. title = @ "set"; self. tableViewStyle = UITab LeViewStyleGrouped; TTTableButton * userButton = [[TTTableButton alloc] init]; userButton. text = @ "deregister cloay"; userButton. delegate = self; userButton. selector = @ selector (actionLoginOut); self. dataSource = [TTSectionedDataSource performancewithobjects: @ "account settings", userButton, @ "Network Settings", [TTTableControlItem itemWithCaption: @ "load images only in wifi network" control: [[UISwitch alloc] init], @ "rating", [TTTableButton itemWithTe Xt: @ "Give us a score, comment" delegate: self selector: @ selector (pingjia)], [TTTableButton itemWithText: @ "feedback" delegate: self selector: @ selector (feedback)], nil]; www.2cto.com} return self;} similar to TableViewController, Three20 encapsulates some table UI controls, such as buttons, and can act as cells directly.:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.