hi guys
joined today , looking expertise
have following code works ok need push selection page. ie. when clicks on cell "k12" list want display page containing information relating k12. new @ programming , mine field least i'm trying learn in stages please give me simple responses guys.
code have far in viewcontroller.m is:
any appreciated..code:#import "viewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; allitems = [[nsarray alloc] initwithobjects:@"k12", @"k14", @"k16", @"k18", @"k42", @"k43", @"k46", @"k53", @"k60", @"k68", @"k81", @"k83", nil]; displayitems = [[nsmutablearray alloc] initwitharray:allitems]; } - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [displayitems count]; } - (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell * cell = [tableview dequeuereusablecellwithidentifier:@"cell"]; if (!cell) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"]; } cell.textlabel.text = [displayitems objectatindex:indexpath.row]; return cell; } - (void)searchbar:(uisearchbar *)searchbar textdidchange:(nsstring *)searchtext { if ([searchtext length] == 0) { [displayitems removeallobjects]; [displayitems addobjectsfromarray:allitems]; } else { //here [displayitems removeallobjects]; (nsstring * string in allitems) { nsrange r = [string rangeofstring:searchtext options:nscaseinsensitivesearch]; if (r.location != nsnotfound) { [displayitems addobject:string]; } } } [tableview reloaddata]; } - (void)searchbarsearchbuttonclicked:(uisearchbar *)asearchbar { [searchbar resignfirstresponder]; } - (void)viewdidunload { [super viewdidunload]; // release retained subviews of main view. } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation != uiinterfaceorientationportraitupsidedown); } @end
i think might easier if head on itunes u, stanford's free online classes on ios programming, , start watching those...
i'm not @ computer right now, method need "didselectrowintableview:withindex:". believe delegate of table view (likely view controller) should 1 implement that.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless

No comments:
Post a Comment