I am a novice to objective-c and developing my first app, a notification-center widget, compiled by "theos" to .deb
Its pretty straightforward: I want to create an Uiscrollview, to scroll (horizontally) through multiple pages, which are added as Uiimage subviews to the scrollview. On one page I add uibuttons to the uiimageview - works!
I tried, just for testing, an uislider on another - works!
All elements are shown as intended and can be controlled, but when I add labels, no matter to what page, it only shows me a white filled rect on the left edge of the uiimageview:
The code is as simple as:
creating the scrollview in the -(void)init
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, VIEW_WIDTH, VIEW_HEIGHT)];
scrollView.pagingEnabled = YES;
scrollView.userInteractionEnabled = YES;
scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
scrollView.showsHorizontalScrollIndicator = NO;
Creating the page subview in -(void)loadFullView
page0 = [[UIImageView alloc] initWithImage:stretchableBgImg];
page0.frame = CGRectMake(PAGEVIEW_OFFSET, 0.0f, VIEW_WIDTH-2*PAGEVIEW_OFFSET, VIEW_HEIGHT);
page0.autoresizingMask = UIViewAutoresizingFlexibleWidth;
page0.userInteractionEnabled = YES;
somewhere later:[scrollView addSubview:page0];
[_view addSubview:scrollView];
Creating label and adding it to the page
UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(PAGEVIEW_OFFSET,0,VIEW_HEIGHT/2,VIEW_WIDTH-2*PAGEVIEW_OFFSET)];
label.text = @"Message";
[page0 addSubview:label];
[label release];
What am I missing? Any help appreciated!