Index Bar

//****************************************************** //****************************************************** //********** RETURN RIGHT HAND OPTIONAL INDEX ********** //****************************************************** //****************************************************** – (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { //—– RETURN NIL IF NO INDEX TO BE SHOWN —– if([AppMain sharedAppMain].CurrentView != CURRENT_VIEW_ALL_MUSIC) return nil; NSMutableArray *tempArray = [[NSMutableArray alloc] init]; [tempArray addObject:@”A”]; [tempArray addObject:@”B”]; [tempArray addObject:@”C”]; [tempArray addObject:@”D”]; [tempArray addObject:@”E”]; [tempArray addObject:@”F”]; [tempArray addObject:@”G”]; [tempArray addObject:@”H”]; [tempArray […]

Read More

Find Song From Persistent ID

MPMediaItem *song; MPMediaPropertyPredicate *predicate; MPMediaQuery *songQuery; predicate = [MPMediaPropertyPredicate predicateWithValue: MyPersistentIdString forProperty:MPMediaItemPropertyPersistentID]; songQuery = [[MPMediaQuery alloc] init]; [songQuery addFilterPredicate: predicate]; if (songQuery.items.count > 0) { //song exists song = [songQuery.items objectAtIndex:0]; CellDetailLabel = [CellDetailLabel stringByAppendingString:[song valueForProperty: MPMediaItemPropertyTitle]]; }

Read More

Read all songs

Add the MediaPlayer.Framework to your project #import <MediaPlayer/MPMediaQuery.h> #import <MediaPlayer/MPMediaPlaylist.h> //—– LIST ALL SONGS —– MPMediaQuery *everything = [[MPMediaQuery alloc] init]; NSLog(@”Logging items from a generic query…”); NSArray *itemsFromGenericQuery = [everything items]; for (MPMediaItem *song in itemsFromGenericQuery) { NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle]; NSLog (@”%@”, songTitle); NSLog (@”\t%@”, [song valueForProperty: MPMediaItemPropertyPersistentID]); }

Read More

Read iTunes Playlists

Add the MediaPlayer.Framework to your project #import <MediaPlayer/MPMediaQuery.h> #import <MediaPlayer/MPMediaPlaylist.h> //—– LIST ALL PLAYLISTS —– MPMediaQuery *myPlaylistsQuery = [MPMediaQuery playlistsQuery]; NSArray *playlists = [myPlaylistsQuery collections]; for (MPMediaPlaylist *playlist in playlists) { NSLog (@”%@”, ); NSLog (@”%@”, ); NSArray *songs = ; for (MPMediaItem *song in songs) { NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle]; NSLog (@”\t\t%@”, […]

Read More

.ARC General

  Before ARC was introduced you had to manually retain/release/autorelease objects to ensure they would exist for as long as you needed them. Forgetting to send retain to an object, or releasing it too many times would cause your app to leak memory or crash. A good overview of ARC: longweekendmobile.com   Turning on ARC for an […]

Read More

Working With Files

Get File Size NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *URL = [documentsDirectory stringByAppendingPathComponent:@”SomeDirectoryName”]; URL = [URL stringByAppendingPathComponent:@”MyFileName.txt”]; NSError *AttributesError = nil; NSDictionary *FileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:URL error:&AttributesError]; NSNumber *FileSizeNumber = [FileAttributes objectForKey:NSFileSize]; long FileSize = [FileSizeNumber longValue]; NSLog(@”File: %@, Size: %ld”, URL, FileSize); Delete All Files In Directory […]

Read More

Progress Bar General

Add Progress View Object Declare in the .h IBOutlet UIProgressView *MyProgressBar; In #ViewController.m //If view could be unloaded //********** VIEW DID UNLOAD ********** – (void)viewDidUnload { [super viewDidUnload]; [MyProgressBar release]; MyProgressBar = nil; } //********** DEALLOC ********** – (void)dealloc { [MyProgressBar release]; [super dealloc]; } Updating Progress Bar MyProgressBar.progress = 0.0; //Floating-point value between 0.0 […]

Read More

Record Video With AVCaptureSession

Apple Resources: Media Capture The following are typically required AVCaptureDevice – represents the input device (camera or microphone) AVCaptureInput – (a concrete subclass of) to configure the ports from the input device (has one or more input ports which are instances of AVCaptureInputPort) AVCaptureOutput – (a concrete subclass of) to manage the output to a […]

Read More