IPhone : migrating contents to UIScrollView in xcode iOS

on Sunday, April 19, 2015

I am a beginner and I am a bit confused about UIScrollView. Here is my case.


Without UIScrollView, I added and made stuffs on UIViewController.


Later on, I realized I have to implement UIScrollView, and now I have to migrate all my contents to inside of the UIScrollView.


If I drag out UIScrollView from storyboard and move all my elements into that scrollview,


I am guessing the order of contents would be:


from: UIViewController -> IBOutlets


to: UIViewController -> UIScrollView -> IBOutlets


Thus, do I have to change the way I access IBOutlets on my view controller?


Will this be the correct way?


before:



@property (strong, nonatomic) IBOutlet UILabel *coursenameLabel;


and access:



_coursenameLabel.text = @"text";


after:



@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;
@property (strong, nonatomic) IBOutlet UILabel *coursenameLabel;


and access like this?



_scrollView.coursenameLabel.text = @"text";


Would this be the simplest way to move all my contents to inside of UIScrollView?


0 comments:

Post a Comment