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
NSError * error; | |
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&error]; | |
if(error) | |
NSLog(@"Failed to set category to the AVAudioSession : %@", [error localizedDescription]); | |
NSURL * musicURL = [[NSBundle mainBundle] URLForResource:@"music_file_name" withExtension:@"mp3"]; | |
self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:musicURL error:&error]; | |
if(error) | |
NSLog(@"Failed to play AVAudioSession : %@", [error localizedDescription]); |
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
NSURL * url = [[NSBundle mainBundle] URLForResource:@"video_file_name" withExtension:@"mov"]; | |
MPMoviePlayerViewController * vc = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; | |
vc.moviePlayer.controlStyle = MPMovieControlStyleFullscreen; | |
[self presentMoviePlayerViewControllerAnimated:vc]; |
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 *) mutableDeepCopy { | |
NSMutableDictionary * returnDict = [[NSMutableDictionary alloc] initWithCapacity:self.count]; | |
NSArray * keys = [self allKeys]; | |
for(id key in keys) { | |
id oneValue = [self objectForKey:key]; | |
id oneCopy = nil; | |
if([oneValue respondsToSelector:@selector(mutableDeepCopy)]) { | |
oneCopy = [oneValue mutableDeepCopy]; |
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
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDirectory = [paths objectAtIndex:0]; |
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
MKZoomScale currentZoomScale = map.bounds.size.width / map.visibleMapRect.size.width; | |
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
UIView * view = ... | |
view.layer.borderColor = color.CGColor; | |
view.layer.borderWidth = width; |
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
UIView * view = ... | |
view.layer.masksToBounds = YES; | |
view.layer.cornerRadius = width; |
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
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)]; | |
textField.leftView = paddingView; | |
textField.leftViewMode = UITextFieldViewModeAlways; |
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)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view | |
{ | |
if(scrollView == _scrollView && view == _contentView) | |
{ | |
// Setting ivars for scrollViewDidZoom | |
_contentOffsetBeforeZoom = _scrollView.contentOffset; | |
_scrollViewBoundsBeforeZoom = _scrollView.bounds; | |
} | |
} |
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
yourView.layer.shadowColor = [[UIColor blackColor] CGColor]; | |
yourView.layer.shadowOffset = CGSizeMake(10.0f, 10.0f); | |
yourView.layer.shadowOpacity = 1.0f; | |
yourView.layer.shadowRadius = 10.0f; |
OlderNewer