This file contains 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 * bottomContentView = [[UIView alloc] init]; | |
[bottomContentView setBackgroundColor:[UIColor darkGrayColor]]; | |
[bottomScrollView addSubview:bottomContentView]; | |
NSArray * contentView = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[bottomContentView]|" | |
options:0 | |
metrics:nil | |
views:NSDictionaryOfVariableBindings(bottomContentView)]; | |
NSArray * contentViewHeight = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[bottomContentView]|" | |
options:0 |
This file contains 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 (strong, nonatomic) NSMutableArray * bombAssPugBomb; // URL strings | |
@property (strong, nonatomic) __block NSMutableArray * pugImages; // Images | |
// we use a block macro to be able to use this array in a block |
This file contains 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{ | |
//1 | |
FISPugCell * pugCell = (FISPugCell *)[tableView dequeueReusableCellWithIdentifier:@"pugCell"]; | |
//2 | |
[pugCell.pugImageView setContentMode:UIViewContentModeScaleAspectFit]; | |
//3 | |
[pugCell.pugImageView setImage:self.pugImages[indexPath.section]]; | |
return pugCell; |
This file contains 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
NSLog(@"You want a response? %@", responseObject); // 1 | |
NSURL * pugURL = [NSURL URLWithString:responseObject[@"pug"]]; | |
[self.bombAssPugBomb addObject:responseObject[@"pug"]]; //2 | |
NSURLRequest * pugImageRequest = [NSURLRequest requestWithURL:pugURL]; |
This file contains 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
AFHTTPRequestOperation * pugImageOperation = [[AFHTTPRequestOperation alloc] initWithRequest:pugImageRequest]; | |
AFImageResponseSerializer * pugImageSerializer = [AFImageResponseSerializer serializer]; | |
pugImageOperation.responseSerializer = pugImageSerializer; |
This file contains 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
[pugImageOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) | |
{ | |
UIImage * pugImage = (UIImage *)responseObject; | |
// 1 | |
[[NSOperationQueue mainQueue] addOperationWithBlock:^ | |
{ | |
imageBlock(pugImage); | |
[self.tableView reloadData]; | |
}]; |
This file contains 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
#import "LDTHomeCatViewController.h" | |
#import "CatGridView.h" | |
@interface LDTHomeCatViewController () | |
@end | |
@implementation LDTHomeCatViewController | |
- (void)viewDidLoad { |
This file contains 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)awakeFromNib{ | |
NSDictionary * catImageReferences = NSDictionaryOfVariableBindings(_topLeftCat, _topRightCat, _bottomLeftCat, _bottomRightCat); | |
NSDictionary * catMetrics = @{ @"catImageWidth" : [NSNumber numberWithFloat:150.0], | |
@"catImageHeight" : [NSNumber numberWithFloat:120.0] | |
}; | |
NSArray * topRowOfCats = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_topLeftCat(==catImageWidth)]-10-[_topRightCat]-|" | |
options:0 | |
metrics:catMetrics |
This file contains 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
@implementation CatGridView | |
-(void)awakeFromNib{ | |
NSDictionary * catImageReferences = NSDictionaryOfVariableBindings(_topLeftCat, _topRightCat, _bottomLeftCat, _bottomRightCat); | |
NSDictionary * catMetrics = @{ @"catImageWidth" : [NSNumber numberWithFloat:150.0], | |
@"catImageHeight" : [NSNumber numberWithFloat:120.0] | |
}; | |
NSArray * topRowOfCats = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_topLeftCat(==catImageWidth)]-10-[_topRightCat]-|" |
This file contains 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)viewDidLoad { | |
[super viewDidLoad]; | |
UINib * gitNib = [UINib nibWithNibName:@"gitHubLogin" | |
bundle:[NSBundle mainBundle]]; | |
GitHubLogin * loginView = [[gitNib instantiateWithOwner:self options:nil] firstObject]; | |
[self.view addSubview:loginView]; | |
[loginView setFrame:self.view.frame]; | |
} |
OlderNewer