Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yaniv92648

macrumors member
Original poster
Oct 26, 2009
96
0
Hi,
I defined a UIView "RowOfThree" inwhich there are 3 labels. i also defined a UIView "Table" inwhich there are numer of objects of type "Row".
the following code is in a method within object "Table":

RowOfThree *rowOfThree = [[RowOfThree alloc] init];
[self addSubview:rowOfThree];

for some reason it doesn't add the view.
i tried defining the labels in "RowOfThree" both in IB and programmatically and it still didn't work.
Thank you.
 
You probably need to give rowOfThree a frame. It most likely has a size of {0, 0}. Example:
Code:
rowOfThree.frame = CGRectMake(0.0, 0.0, 50.0, 50.0);
 
You say you implemented rowof3 in an IBOutlet, that should like this:
Code:
@class RowOf3
@interface WhateverName : UIView {


IBOutlet RowOf3 *rowof3;

}
@end
But did you also call RowOf3.h at the top of your class (.m) file? Another thing you could do is:
Code:
RowOf3 *rowof3=[RowOf3.h initWithNibName:[NSString stringWithFormat:@"NibName.xib"]];
//With this example I do not think you need to call rowof3 the IBOutlet
and make a RowOf3.xib file. One last thing. If you've already declared RowOf3 as an IBOutlet, you can simply do this to add it to the current view:
Code:
[self addSubview:rowof3];
Those are my suggestions, tell me if they work!

Edit: Sorry, i misread your post, you said you implemented the view in interface builder, not IBOutlet, but you still should make it an IBOutlet, as I showed.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.