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)viewDidAppear:(BOOL)animated { | |
| [super viewDidAppear:animated]; | |
| self.theScroller.contentSize=CGSizeMake(280.0,1000.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
| NSError *error; | |
| // turn the responseData into an NSDictionary object | |
| NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error]; | |
| NSArray *latestLoans = json[@"loans"]; | |
| NSDictionary *loan = latestLoans[0]; | |
| // build an info object out of the dictionary | |
| // this is a new way to write dictionaries as of iOS6 | |
| NSDictionary *info = @{ | |
| @"who":loan[@"name"]; |
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
| // here i register a MPMusicPlayerController object to the NSNotificationCenter | |
| MPMusicPlayerController *musicPlayer = | |
| [MPMusicPlayerController applicationMusicPlayer]; | |
| [musicPlayer setQueueWithItemCollection: userMediaItemCollection]; | |
| [musicPlayer beginGeneratingPlaybackNotifications]; | |
| NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; | |
| [notificationCenter |
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
| -(UITableViewCell *)tableView:(UITableView *)tableView | |
| cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| NSString *CellIdentifier; | |
| // nice! make the conditional here | |
| if ((indexPath.row %2) == 0 ) { | |
| CellIdentifier = @"rowOdd"; | |
| } else { | |
| CellIdentifier = @"rowEven"; |
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
| - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"]; | |
| UILabel *label; | |
| label = (UILabel *)[cell viewWithTag:1]; | |
| label.text = [NSString stringWithFormat:@"%d", indexPath.row]; | |
| label = (UILabel *)[cell viewWithTag:2]; | |
| label.text = [NSString stringWithFormat:@"%d", NUMBER_OF_ROWS - indexPath.row]; |
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
| for (UIView *theSubView in parentView.subViews) { | |
| // do something to the subView | |
| } |
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
| -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| static NSString *cellIdentifier = @"cellIdentifier"; | |
| UITableVIewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
| if(cell == nil) { | |
| cell = [[UITableVIewCell alloc] initWithStyle:UITableVIewCellStyleDefault resuseIdentifier:cellIdentifier]; | |
| // create a new label with the size we need | |
| UILabel *myLabel = [[UILabel alloc] init]; |
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
| -(UITableViewCell *)tableView:(UITableView *)tableView | |
| cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
| UILabel *cellLabel; | |
| cellLabel = (UILabel *)[cell viewWithTag:1000]; | |
| cellLabel.text = [tableData objectAtIndex:indexPath.row]; | |
| UIImageView *cellIcon = (UIImageView *)[cell viewWithTag:1010]; |
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
| -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| static NSString *cellIdentifier = @"Cell"; | |
| UITableVIewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
| if(cell == nil) { | |
| cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; | |
| } |