|
|
#1 |
|
UITableViewCell & IB
Hey,
What's the correct way to go about customizing a UITableViewCell in IB and hooking it up to a UITableViewController? I tried: 1. Created XIB with File's Owner as myTableViewController and UITableView component. 2. Created the myTableViewController UITableViewController subclass and hooked up the UITableView. 3. Added a UITableViewCell to the XIB and gave it the class name of a UITableViewCell subclass I made. 4. Set the UITableViewCell reuse identifier and customized it with an image and what not. myTableViewController creates the cells like so: Code:
-( UITableViewCell * )tableView:( UITableView * )tableView cellForRowAtIndexPath:( NSIndexPath * )indexPath
{
static NSString *identity = @"MyCustomCell";
MyCustomCell *cell = ( MyCustomCell * )[tableView dequeueReusableCellWithIdentifier:identity];
if( cell == nil )
{
cell = [[[MyCustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:identity] autorelease];
}
cell.text = @"test";
return cell;
}
Thanks for your time, -Ross |
|
|
|
0
|
|
|
#2 |
|
I don't see where you're loading your custom cell from the NIB...it looks like you're calling the init function on the default table cell which you inherit from (which will produce the behavior you describe).
__________________
iNeedStuff Shopping Assistant - MacLife called it "the ultimate iPhone grocery list maker". Follow me on Twitter Need a developer? PM me. |
|
|
|
0
|
|
|
#3 | |
|
Quote:
-Ross |
||
|
|
0
|
|
|
#4 |
|
Have you figured this out yet?
I too am having the same issue as yourself. I've done it exactly the same way too. (and obviously get the same output) I realise that I have to load the class from nib but not sure how to do this. As you said you dont want to load the complete nib (which is already loaded as the tableview etc gets rendered) I just want to use the cell from the nib. |
|
|
|
0
|
|
|
#5 |
|
I create custom cell via class
Code:
@interface CustomCell:UITableViewCell Code:
-(id)initWithFrame:(CRect)frame reuseIdentifier:(NSString *)reuseIdentifier{
--some image creation--
--some labels creation---
-some buttons creatipn--
[self.contentView addSubView:myimage]
...
}
-(void)layoutSubViews{
[super layoutSubviews];
CGRect baserect....
determine rects for elements
}
|
|
|
|
0
|
|
|
#6 | |
|
Quote:
|
||
|
|
0
|
|
|
#7 | |
|
Quote:
-Ross |
||
|
|
0
|
|
|
#8 | |
|
Quote:
Thanks for the replies and glad you got it sorted. |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Strange accounts under sharing & permissions | jcloughesy | Mac Basics and Help | 5 | Sep 14, 2011 07:01 PM |
| B & W Zeppelin Air - A house filler? | MaCamZa | Mac Peripherals | 4 | Jun 30, 2011 01:52 PM |
| Interface Builder Sync Problem (Xcode/IB 3.2 & Snow Leopard 10.6.2) | Darkroom | iPhone/iPad Programming | 8 | Jun 1, 2010 03:57 PM |
| exact specs of 12" IB & PB memory | Nameless | Buying Tips, Advice and Discussion (archive) | 21 | Dec 26, 2004 01:02 PM |
All times are GMT -5. The time now is 03:07 AM.







Linear Mode

