Skip to content

Instantly share code, notes, and snippets.

@nwg
Created April 20, 2012 21:36
Show Gist options
  • Save nwg/2432048 to your computer and use it in GitHub Desktop.
Save nwg/2432048 to your computer and use it in GitHub Desktop.
- (void)someMethod {
id<SocializeEntity> newEntity = [SocializeEntity entityWithKey:@"newEntity" name:@"New Entity"];
likeButton.entity = newEntity;
}
@interface SocializeLikeButton : UIView <SocializeServiceDelegate>
...
@property (nonatomic, retain) UIImage *disabledImage;
@property (nonatomic, retain) UIImage *inactiveImage;
@property (nonatomic, retain) UIImage *inactiveHighlightedImage;
@property (nonatomic, retain) UIImage *activeImage;
@property (nonatomic, retain) UIImage *activeHighlightedImage;
@property (nonatomic, retain) UIImage *likedIcon;
@property (nonatomic, retain) UIImage *unlikedIcon;
@end
- (id)init {
...
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(likeButtonChanged:) name:SocializeLikeButtonDidChangeStateNotification object:nil];
...
}
- (void)likeButtonChanged:(NSNotification*)notification {
// Update your views here
}
- (void)someMethod {
[likeButton refresh];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
SocializeLikeButton *likeButton = [[SocializeLikeButton alloc] initWithFrame:CGRectMake(120, 30, 0, 0) entity:self.entity viewController:self];
// Turn of automatic sizing of the like button (default NO)
// likeButton.autoresizeDisabled = YES;
// Hide the count display
// likeButton.hideCount = YES;
[self.view addSubview:likeButton];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment