ios - UITableViewController doesn't work properly in xcode 4.2? -
ios - UITableViewController doesn't work properly in xcode 4.2? -
can tell me, doing wrong? have created quick project selecting template 'empty application'. created new controller subclass uitableviewcontroller.
i wrote below piece of code phone call controller:
-(bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. // self.window.backgroundcolor = [uicolor whitecolor]; mytableviewcontroller *mtvc = [[mytableviewcontroller alloc] init]; uinavigationcontroller *nav = [[uinavigationcontroller alloc] init]; [nav pushviewcontroller:mtvc animated:yes]; [self.window addsubview:nav.view]; [self.window makekeyandvisible]; homecoming yes; }
and fill uitableviewcontroller's methods check if working:
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // homecoming number of rows in section. homecoming 1; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"mycell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } // configure cell... cell.text = @"test"; homecoming cell; }
when seek select cell table method didselectrowatindexpath doesn't phone call @ all.
i new in iphone programming maybe doing wrong?
i have posted problem here creating tableviewcontroller
i have conducted few more tests , seems arc caused problems. have created few projects like:
creating simple view table without xib in controller creating table view using uiviewcontroller without xib creating table view using uiviewcontroller xibi tried scroll downwards table, in each case programme crashed. second, set delegate cannot utilize method didselectrowatindexpath, it's wired datasource methods worked well.
here stack after programme crashed when tried scroll downwards table cells.
> (gdb) bt > #0 0x0156009b in objc_msgsend () > #1 0x07821800 in ?? () > #2 0x000ad589 in -[uitableview(uitableviewinternal) _createpreparedcellforglobalrow:] () > #3 0x00098dfd in -[uitableview(_uitableviewprivate) _updatevisiblecellsnow:] () > #4 0x000a7851 in -[uitableview layoutsubviews] () > #5 0x00052322 in -[uiview(calayerdelegate) layoutsublayersoflayer:] () > #6 0x013bde72 in -[nsobject performselector:withobject:] () > #7 0x01d6692d in -[calayer layoutsublayers] () > #8 0x01d70827 in ca::layer::layout_if_needed () > #9 0x01cf6fa7 in ca::context::commit_transaction () > #10 0x01cf8ea6 in ca::transaction::commit () > #11 0x01d9237a in ca::display::displaylink::dispatch () > #12 0x01d921af in ca::display::timerdisplaylink::callback () > #13 0x01390966 in __cfrunloop_is_calling_out_to_a_timer_callback_function__ () > #14 0x01390407 in __cfrunloopdotimer () > #15 0x012f37c0 in __cfrunlooprun () > #16 0x012f2db4 in cfrunlooprunspecific () > #17 0x012f2ccb in cfrunloopruninmode () > #18 0x012a5879 in gseventrunmodal () > #19 0x012a593e in gseventrun () > #20 0x00013a9b in uiapplicationmain () > #21 0x00002588 in main (argc=1, argv=0xbfffed80) @ /users/lsd/development/iphone/mytableview/mytableview/main.m:16 > #22 0x000024e5 in start () (gdb)
i have created same projects same lines of code unchecked arc, start working charm.
john
i think u missed delegate - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1;//number of section in tableview; }
ios automatic-ref-counting
Comments
Post a Comment