Personalized UIView created with Interface Builder
Posted
by Malox
on Stack Overflow
See other posts from Stack Overflow
or by Malox
Published on 2010-04-27T13:11:58Z
Indexed on
2010/04/27
13:13 UTC
Read the original article
Hit count: 269
I need to project a personalized UIView with a UIImageView and 3 UILabel. I need to allocate more of this view because I want put it into a UIScrollView. I would avoid to generate the view programatically because it's difficult and boring design it. My idea is to create a new class that extends UIView and design it with interface builder. For example my Personalized View code is like that:
#import <UIKit/UIKit.h>
@interface PersonalizedPreview : UIView {
IBOutlet UIImageView *image;
IBOutlet UILabel *first_label;
IBOutlet UILabel *second_label;
IBOutlet UILabel *third_label;
}
-(void) setImage:(UIImage *)image;
@property (nonatomic, retain) IBOutlet UIImageView *image;
@property (nonatomic, retain) IBOutlet UILabel *label;
....
@end
I would create an associated xib file for this view and initialize it simply specifing the xib file. Note that I don't want create a specific ViewController for this view and PersonalizedView is instantiate at runtime not when the app runs, moreover I don't know how many PersonalizedView I will instantiate, it depends on runtime execution.
Anyone can help me? Thank you very much.
© Stack Overflow or respective owner