688,702 questions
2346
votes
51
answers
771k
views
Vertically align text to top within a UILabel
I have a UILabel with space for two lines of text. Sometimes, when the text is too short, this text is displayed in the vertical center of the label.
How do I vertically align the text to always be ...
1951
votes
28
answers
539k
views
What's the difference between the atomic and nonatomic attributes?
What do atomic and nonatomic mean in property declarations?
@property(nonatomic, retain) UITextField *userName;
@property(atomic, retain) UITextField *userName;
@property(retain) UITextField *...
1797
votes
99
answers
657k
views
How can I make a UITextField move up when the keyboard is present - on starting to edit?
With the iOS SDK:
I have a UIView with UITextFields that bring up a keyboard. I need it to be able to:
Allow scrolling of the contents of the UIScrollView to see the other text fields once the ...
1617
votes
29
answers
712k
views
Using Auto Layout in UITableView for dynamic cell layouts & variable row heights
How do you use Auto Layout within UITableViewCells in a table view to let each cell's content and subviews determine the row height (itself/automatically), while maintaining smooth scrolling ...
1608
votes
30
answers
978k
views
Transport security has blocked a cleartext HTTP
What setting do I need to put in my info.plist to enable HTTP mode as per the following error message?
Transport security has blocked a cleartext HTTP (http://) resource
load since it is insecure....
1503
votes
44
answers
527k
views
Passing data between view controllers
I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following:
I have a view that acts as a data entry form and I want to give the user the option to select multiple ...
1412
votes
39
answers
517k
views
How can I check for an active Internet connection on iOS or macOS?
I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries.
I came up with a way to do this using an NSURL. The way I ...
1331
votes
82
answers
1.0m
views
Xcode - How to fix 'NSUnknownKeyException', Reason: "… this class is not key value coding-compliant for the key X" error?
I'm trying to link a UILabel with an IBOutlet created in my class.
My application is crashing with the following error"
***
Terminating app due to uncaught exception
'NSUnknownKeyException', ...
1325
votes
27
answers
487k
views
How do I sort an NSMutableArray with custom objects in it?
What I want to do seems pretty simple, but I can't find any answers on the web. I have an NSMutableArray of objects, and let's say they are 'Person' objects. I want to sort the NSMutableArray by ...
1303
votes
19
answers
192k
views
performSelector may cause a leak because its selector is unknown
I'm getting the following warning by the ARC compiler:
"performSelector may cause a leak because its selector is unknown".
Here's what I'm doing:
[_controller performSelector:NSSelectorFromString(@"...
1282
votes
21
answers
589k
views
How do I check if a string contains another string in Objective-C?
How can I check if a string (NSString) contains another smaller string?
I was hoping for something like:
NSString *string = @"hello bla bla";
NSLog(@"%d",[string containsSubstring:@"hello"]);
But ...
1278
votes
42
answers
545k
views
How can I disable the UITableView selection?
When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
1271
votes
43
answers
1.1m
views
How can I develop for iPhone using a Windows development machine?
Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?
The only other way I can think of doing this is to run a Mac VM image on a ...
1162
votes
37
answers
586k
views
How can I change the name of an iOS app in Xcode?
I began an iPhone project the other day with a silly development code name, and now I want to change the name of the project since it's nearly finished. How can I do this?
1094
votes
61
answers
676k
views
How to change Status Bar text color in iOS
My application has a dark background, but in iOS 7 the status bar became transparent. So I can't see anything there, only the green battery indicator in the corner. How can I change the status bar ...