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

AbhishekApple

macrumors member
Original poster
Aug 5, 2010
86
0
I have created two views (mainView & detailView) in IB.... and have added the detailView as subview to mainView....

Now when i want to add subviews to detailView it is not allowing to do so..& gives a build error..

Code:
@synthesize detailView;

- (void)viewDidLoad {
    [super viewDidLoad];
	//detailView = [[UIView alloc] init];
	detailView.frame = CGRectMake(230, 140, 538, 820);
	[self.view addSubview:detailView];     
}
-(void)createsubview{
        slideUpView = [[UIView alloc] initWithFrame:frame];
     [COLOR="DarkOrange"]   [[detail view] addSubview:slideUpView]; [/COLOR] //----warning : UIView may not respond to '-view'
      //following works fine 
       //[[self.view] addSubview:slideUpView];  
}

Also when i am creating custom class UIView, same error is given..
Code:
@interface ThumbDetailView : UIView{
....
....
}

@implementation ThumbDetailView

-(id)initWithFrame:(CGRect)_frame{
	self=[super initWithFrame:_frame];
	if (self) {
		[self setUserInteractionEnabled:YES];
		[self setExclusiveTouch:YES];
	}
	return self;
}
-(void)createView:(NSString *)_prodCode{
	
	[COLOR="DarkOrange"]CGRect bounds = [[self view] bounds];  [/COLOR]  // warning---- ThumbDetailView may not respond to '-view'
        // add subviews to container view
	[[COLOR="SandyBrown"]self.view [/COLOR]addSubview:lblprodNm]; // warning---- ThumbDetailView may not respond to '-view'
}

Plz suggest how to add subView to existing subview
 
'self' is-a UIView already, so 'self.view' does not make any sense.

Code:
[self addSubview:lblprodNm]
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.