iOS grows daily once (day 8)

Source: Internet
Author: User

These days have some tasks to follow, the learning of iOS pull, see to seize it, see the turn to learn is UITableView.

BIDViewController.h

#import <UIKit/UIKit.h>@interface  Bidviewcontroller:uiviewcontroller< Uitableviewdatasource, uitableviewdelegate>*computers; @end

Bidviewcontroller.m

#import "BIDViewController.h"#import "BIDNameAndColorCell.h"@implementationBidviewcontrollerStaticNSString *celltableidentifier =@"Celltableidentifier";//Reuse Tags- (void) viewdidload{[Super Viewdidload]; Self.computers= @[    @{@"Name":@"MacBook",@"Color":@" White"},    @{@"Name":@"MacBook Pro",@"Color":@"Silver"},    @{@"Name":@"IMac",@"Color":@"Silver"},    @{@"Name":@"Mac Mini",@"Color":@"Silver"},    @{@"Name":@"Mac Pro",@"Color":@"Silver"}];//assigning values to NsarrayUITableView*tableview = (ID) [Self.view Viewwithtag:1];//This view is managed by the controller and Viewwithtag is based on the tab setTableview.rowheight = $;//set the height of each rowuinib *nib = [uinib nibwithnibname:@"Bidnameandcolorcell"Bundle:nil]; [TableView registernib:nib forcellreuseidentifier:celltableidentifier];}#pragmaMark-#pragmaMark Table Data Source methods-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) section{return[Self.computers Count];}-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath*) indexpath{Bidnameandcolorcell*cell =[TableView Dequeuereusablecellwithidentifier:celltableidentifier]; Nsdictionary*rowdata =Self.computers[indexpath.row]; Cell.name= rowdata[@"Name"]; Cell.color= rowdata[@"Color"]; returncell;}@end

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.