iphone - Reloading tableView when subclassed causing crash -


hey guys! have problems reloading tableview. have subclasses tableview, class called radiotable. have subclasses tableviewcells, thats not important here.

i need point out i'm pretty new, , built subclass tutorials , stuff.

first of all, here error message i'm getting when try reload data. reloading [self.tableview reloaddata].

*** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uitableviewcontroller loadview] loaded "mainview" nib didn't uitableview.' 

okay, problem pretty clear. view(my nib-file) not have tableview's connected files owner. , thats tried solve. tried add iboutlet in subclass, , setting tableview-property there.

(my tableview-subclass inherited uitableview, thats clear)

here init-code:

- (id)initwithstyle:(uitableviewstyle)style {   if ((self = [super initwithstyle:style])){   radiotable *atableview = [[radiotable alloc] initwithframe:self.tableview.frame style:style];   [atableview setdelegate:self];   [atableview setdatasource:self];   [atableview setswipedelegate:self];   [atableview setrowheight:54];       [self settableview:atableview];         [self.tableview setscrollenabled:no];         [self.tableview setrowheight:80];         [self.tableview setseparatorstyle:uitableviewcellseparatorstylesingleline];         [self.tableview setseparatorcolor:[uicolor lightgraycolor]];   [atableview release];   }   return self; } 

the tableview works fine when launch app, works perfect. problem occours when try reload it.

i'm not sure if solve problem, don't create view controller's view in init method. instead, override loadview , create table view in method. , assign table not tableview property view controller's view property.

see documentation loadview , viewdidload more info.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -