What’s the best practice for naming Swift files that add extensions to existing objects?

It’s possible to add extensions to existing Swift object types using extensions, as described in the language specification. As a result, it’s possible to create extensions such as: extension String { var utf8data:NSData { return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! } } However, what’s the best naming practice for Swift source files containing such extensions? In the … Read more

iOS: Modal ViewController with transparent background

I’m trying to present a view controller modally, with a transparent background. My goal is to let both the presenting and presented view controllers’s view to be displayed at the same time. The problem is, when the presenting animation finishes, the presenting view controller’s view disappears. – (IBAction)pushModalViewControllerButtonPressed:(id)sender { ModalViewController *modalVC = [[ModalViewController alloc] init]; … Read more

Storyboard doesn’t contain a view controller with identifier

I keep getting the following error: Storyboard (<UIStoryboard: 0x7ebdd20>) doesn’t contain a view controller with identifier ‘drivingDetails’ This is the code: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@”drivingDetails”]; controller.title = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@”name”]; [self.navigationController pushViewController:controller animated:YES]; } I have already set the identifier on the UIStoryboard but I’m still getting this … Read more

Objective-C implicit conversion loses integer precision ‘NSUInteger’ (aka ‘unsigned long’) to ‘int’ warning

I’m working through some exercises and have got a warning that states: Implicit conversion loses integer precision: ‘NSUInteger’ (aka ‘unsigned long’) to ‘int’ #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { @autoreleasepool { NSArray *myColors; int i; int count; myColors = @[@”Red”, @”Green”, @”Blue”, @”Yellow”]; count = myColors.count; // <<< issue warning … Read more

Add views in UIStackView programmatically

I’m trying to add views in UIStackView programmatically. For now My code is: UIView *view1 = [[UIView alloc]init]; view1.backgroundColor = [UIColor blackColor]; [view1 setFrame:CGRectMake(0, 0, 100, 100)]; UIView *view2 = [[UIView alloc]init]; view2.backgroundColor = [UIColor greenColor]; [view2 setFrame:CGRectMake(0, 100, 100, 100)]; [self.stack1 addArrangedSubview:view1]; [self.stack1 addArrangedSubview:view2]; When i deploy the app, there is only 1 view … Read more

Add a UIView above all, even the navigation bar

I want to display, above any other views, even the navigation bar, a kind of “pop-up” view that looks like this: full screen black background with a 0.5 alpha to see the other UIViewController underneath. a UIView window in the middle with some information, (a calendar if you want to know everything). To do that, … Read more