Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "MyPointView.h"
- @implementation MyPointView
- +(instancetype)instanceFromNib
- {
- MyPointView *view = [[[UINib nibWithNibName:@"MyPointView" bundle:nil] instantiateWithOwner:self options:nil] firstObject];
- return view;
- }
- +(instancetype)instanceWithPoints:(NSArray*)points
- {
- MyPointView *view = [self instanceFromNib];
- view.myPoints = points;
- return view;
- }
- +(instancetype)instanceWithPoints:(NSArray*)points andName:(NSString*)name
- {
- MyPointView *view = [self instanceFromNib];
- view.myPoints = points;
- view.routeName = name;
- return view;
- }
- -(void)setMyPoints:(NSArray *)myPoints
- {
- //Do some custom procesing on the points array first, if you want. Notice how this only has to be done in one place.
- _myPoints = myPoints;
- }
- -(void)setRouteName:(NSString *)routeName
- {
- //We'll lowercase this string before setting. Notice how this only has to be done in one place.
- _routeName = [routeName uppercaseString];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement