开发者

missing uiTableView variable

I have followed this tutorial http://blogs.wrox.com/article/creating-a-simple-ipad-application开发者_StackOverflow-table-view/ (creating a uitableview and populating it).

I want to create a button, when press the table will clear and updated.

I would do it like this ..

[array RemoveAllObjects];
[table reloadData];

However, in the tutorial there is no uiTableView variable created, so I cannot do [table reloadData] ... how can I fix this please?


if there is no table view variable then create it like as in .h file

IBOutlet UITableView *tblView;

define property

@property (nonatomic, retain) IBOutlet UITableView *tblView;

and synthesize in .m file

@synthesize tblView;

and connect it to IB.


As saadnib said, declare the variable in the header and wire it up via interface builder.

There is no need in this case however to add a property as I doubt you will need to access the tableview from outside of this class.

And before people say about being able to do...

self.tblview = nil;

to release the memory, being more explicit with your memory handling and doing...

 [tblview release]; 
 tbleview = nil;

is no bad thing and prevents errors if someone changes your 'retain' to an 'assign' etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜