Skip to content

Commit

Permalink
imageNamed:nil reports log error in xcode 5, check this before settin…
Browse files Browse the repository at this point in the history
…g image names
  • Loading branch information
robraux committed Mar 9, 2014
1 parent 28d1ff3 commit 407b085
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
8 changes: 6 additions & 2 deletions quickdialog/QBooleanElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ -(NSNumber *)numberValue {
}

- (void)setOnImageName:(NSString *)name {
self.onImage = [UIImage imageNamed:name];
if(name != nil) {
self.onImage = [UIImage imageNamed:name];
}
}

- (void)setOffImageName:(NSString *)name {
self.offImage = [UIImage imageNamed:name];
if(name != nil) {
self.offImage = [UIImage imageNamed:name];
}
}

- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {
Expand Down
6 changes: 4 additions & 2 deletions quickdialog/QImageElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ - (QImageElement *)initWithTitle:(NSString *)aTitle detailImage:(UIImage *)anIma
}

- (void)setImageValueNamed:(NSString *)name {
self.imageValue = [UIImage imageNamed:name];
[self reducedImageIfNeeded];
if(name != nil) {
self.imageValue = [UIImage imageNamed:name];
[self reducedImageIfNeeded];
}
}

- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {
Expand Down
6 changes: 4 additions & 2 deletions quickdialog/QLabelElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ - (QLabelElement *)initWithTitle:(NSString *)title Value:(id)value {
}

-(void)setImageNamed:(NSString *)name {
self.image = [UIImage imageNamed:name];
if(name != nil) {
self.image = [UIImage imageNamed:name];
}
}

- (NSString *)imageNamed {
Expand All @@ -45,7 +47,7 @@ - (NSString *)imageNamed {

-(void)setIconNamed:(NSString *)name {
#if __IPHONE_7_0
if ([self.image respondsToSelector:@selector(imageWithRenderingMode:)]) {
if ([self.image respondsToSelector:@selector(imageWithRenderingMode:)] && name != nil) {
self.image = [[UIImage imageNamed:name] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
}
#endif
Expand Down
5 changes: 4 additions & 1 deletion quickdialog/QRadioElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ -(void)setSelected:(NSInteger)aSelected {
_selected = aSelected;

self.preselectedElementIndex = [NSIndexPath indexPathForRow:_selected inSection:0];
self.image = [UIImage imageNamed:[_itemsImageNames objectAtIndex:(NSUInteger) self.selected]];

if([_itemsImageNames objectAtIndex:(NSUInteger) self.selected] != nil) {
self.image = [UIImage imageNamed:[_itemsImageNames objectAtIndex:(NSUInteger) self.selected]];
}

[self handleEditingChanged];
}
Expand Down
4 changes: 3 additions & 1 deletion quickdialog/QSelectItemElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ - (QSelectItemElement *)initWithIndex:(NSUInteger)index selectSection:(QSelectSe
}

-(void)setCheckmarkImageNamed:(NSString *)name {
self.checkmarkImage = [UIImage imageNamed:name];
if(name != nil) {
self.checkmarkImage = [UIImage imageNamed:name];
}
}

- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller
Expand Down

0 comments on commit 407b085

Please sign in to comment.