Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)configureWithVenue:(Venue *)venue | |
{ | |
self.venueName = venue.name; | |
self.addressLabel.text = [venue.address fullAddressWithMultipleLines:YES includeCountry:NO]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
if(nil == self.mapView) { | |
MKMapView *mapView = [[MKMapView alloc] initWithFrame:self.mapViewContainer.bounds]; | |
self.mapView = mapView; | |
[self.mapViewContainer addSubview:mapView]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SMLBookshelfTransitionAnimator *animator = [[SMLBookshelfTransitionAnimator alloc] init]; | |
animator.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"left.jpg"]]; | |
animator.rightView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right.jpg"]]; | |
animator.dismissing = YES; // Required to automaticaly handle left/right sides |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)flipButtonPressed:(id)sender | |
{ | |
if (self.currentView == self.primaryView) { | |
self.cardBackView.showTellMeWhenSwitch = YES; | |
__block UIImage *image = self.eventCardView.eventImageView.image; | |
__weak GSEventStarCollectionViewCell *weakSelf = self; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
image = [image applyMediumDarkEffectWithBlurRadius:10.0f]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
weakSelf.cardBackView.imageView.image = image; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableDictionary *mutableAttributeValues = [attributeValues mutableCopy]; | |
NSString *resourceIdentifier = AFResourceIdentifierFromReferenceObject([self referenceObjectForObjectID:objectID]); | |
[childContext performBlock:^{ | |
[backingContext performBlockAndWait:^{ | |
NSManagedObjectID *backingObjectID = [self objectIDForBackingObjectForEntity:entity withResourceIdentifier:resourceIdentifier]; | |
NSManagedObject *backingObject = [backingContext existingObjectWithID:backingObjectID error:nil]; | |
[backingObject setValuesForKeysWithDictionary:mutableAttributeValues]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@property (nonatomic, weak) UIView *someViewA; | |
@property (nonatomic, weak) UIView *someViewB; | |
- (void)someMethod | |
{ | |
NSLog(@"view: %@", self.someViewA); // Prints a nil value | |
NSLog(@"view: %@", self.someViewB); // Prints the view | |
} | |
- (UIView *)someViewA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)_updateCurrentEventController | |
{ | |
NSInteger pageIndex = floorf(scrollView.contentOffset.x / scrollView.bounds.size.width); | |
if (pageControl.currentPage == pageIndex) { | |
return; | |
} | |
// Put your event code somewhere here or after | |
NSArray *dates = [events dates]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)scrollViewDidEndDragging:(UIScrollView *)theScrollView willDecelerate:(BOOL)decelerate | |
{ | |
if (NO == decelerate) { | |
[self _updateCurrentEventController]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)authenticateLocalPlayer | |
{ | |
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { | |
[self callSelfOnMainThread:@selector(didAuthenticateLocalPlayer:) withArg:error error:nil]; | |
}]; | |
} | |
- (void)callSelf:(SEL)selector withArg:(id)arg error:(NSError*)err | |
{ | |
assert([NSThread isMainThread]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: GameCenter does not guarantee that callback blocks will be execute on the main thread. | |
// As such, your application needs to be very careful in how it handles references to view | |
// controllers. If a view controller is referenced in a block that executes on a secondary queue, | |
// that view controller may be released (and dealloc'd) outside the main queue. This is true | |
// even if the actual block is scheduled on the main thread. In concrete terms, this code | |
// snippet is not safe, even though viewController is dispatching to the main queue: | |
// | |
// [object doSomethingWithCallback: ^() | |
// { | |
// dispatch_async(dispatch_get_main_queue(), ^(void) |