UIScrollView not showing
I have a simple ViewController that looks like this:
@interface MyViewController : UIViewController<UIScrollViewDelegate> {
UIScrollView *scrollView;
UILabel *label;
}
...
@property stuff
...
Now, what I'm trying to do with this Controller is have a ScrollView handle a really large label of text that I have. So in the viewDidLoad method of MyViewController.m I have:
scrollView.contentSize = CGSizeMake(1000,1000);
scrollView.delegate = self;
scrollView.clipsToBounds = YES;
[self.view addSubview:scrollView];
And I get a blank screen that I cannot scroll around on. It's just a white screen. Before adding the label part, I thought I would try to set up the scroll view first, and this is not even working. Shouldn't I see so开发者_运维问答me scroll bars when I move my fingers around? How do I set up the scroll view so that it contains a label?
Thanks!
The scrollView wont be scrollable until you actually place content inside it which exceeds its frame. So, add your label to the scrollview and it should become scrollable.
精彩评论