Questions tagged [ios]

iOS is the mobile operating system running on the Apple iPhone, iPod touch, and iPad. Use this tag [ios] for questions related to programming on the iOS platform. Use the related tags [objective-c] and [swift] for issues specific to those programming languages.

ios
Filter by
Sorted by
Tagged with
2340 votes
51 answers
764k 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 ...
Stefan's user avatar
  • 28.9k
1947 votes
28 answers
534k 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 *...
Alex Wayne's user avatar
  • 183k
1792 votes
99 answers
652k 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 ...
1614 votes
29 answers
708k 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 ...
smileyborg's user avatar
  • 30.4k
1601 votes
30 answers
959k 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....
Jeef's user avatar
  • 27.1k
1500 votes
44 answers
524k 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 ...
Matt Price's user avatar
  • 34.6k
1406 votes
39 answers
512k 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 ...
Brock Woolf's user avatar
  • 46.9k
1325 votes
27 answers
486k 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 ...
rustyshelf's user avatar
1322 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', ...
1304 votes
19 answers
191k 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(@"...
Eduardo Scoz's user avatar
  • 24.7k
1282 votes
21 answers
586k 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 ...
Jonathan.'s user avatar
  • 54.9k
1278 votes
42 answers
540k 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?
davidmytton's user avatar
1270 votes
42 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 ...
1153 votes
37 answers
572k 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?
Robert Gould's user avatar
  • 69.2k
1087 votes
61 answers
672k 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 ...
Oleksandr Veremchuk's user avatar
1049 votes
12 answers
338k views

How do I animate constraint changes?

I'm updating an old app with an AdBannerView and when there is no ad, it slides off screen. When there is an ad it slides on the screen. Basic stuff. Old style, I set the frame in an animation block. ...
DBD's user avatar
  • 23.1k
1048 votes
14 answers
447k views

Constants in Objective-C

I'm developing a Cocoa application, and I'm using constant NSStrings as ways to store key names for my preferences. I understand this is a good idea because it allows easy changing of keys if ...
Allyn's user avatar
  • 20.4k
950 votes
14 answers
465k views

How do I convert an NSString value to NSData?

How do I convert an NSString value to NSData?
user avatar
922 votes
66 answers
777k views

Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'

I am trying to get a large (and working on Xcode 11!) project building in Xcode 12 (beta 5) to prepare for iOS 14. The codebase was previously in Objective-C, but now it contains both Objective-C and ...
btxios's user avatar
  • 9,405
909 votes
36 answers
531k views

How to check iOS version?

I want to check if the iOS version of the device is greater than 3.1.3 I tried things like: [[UIDevice currentDevice].systemVersion floatValue] but it does not work, I just want a: if (version > ...
John's user avatar
  • 9,109
909 votes
25 answers
554k views

Xcode error "Could not find Developer Disk Image"

When attempting to run a build on a connected iOS device in Xcode I get the error: Could not find Developer Disk Image I saw that there was a public beta for Xcode, so I installed it. One of the ...
Nathan Kramer's user avatar
857 votes
11 answers
172k views

Xcode 7 error: "Missing iOS Distribution signing identity for ..."

I tried to upload my App to iTunes Connect resp. AppStore and got the following error: Failed to locate or generate matching signing assets Xcode attempted to locate or generate matching signing ...
Awsed's user avatar
  • 9,114
832 votes
19 answers
279k views

Xcode 6: Keyboard does not show up in simulator

The keyboard does not show up when I run the simulator and click in the UITextView. How do I re-enable the keyboard? It used to work but now it doesn't - I don't know what I might have clicked by ...
Katsu's user avatar
  • 8,656
819 votes
33 answers
296k views

Loaded nib but the 'view' outlet was not set

I added a new nib file to my project, and tried to load it. However, when I click on the toolbar icon that is supposed to take me to the view that I created, I get an NSInternalInconsistencyException ...
John's user avatar
  • 10.9k
793 votes
14 answers
145k views

Xcode process launch failed: Security

I have been developing an app for 1 or 2 weeks now and just yesterday I have updated my iPhone 5S to the iOS 8 GM. Everything worked fine and I could test on my device as well until I deleted the app ...
Tom Spee's user avatar
  • 9,219
792 votes
32 answers
241k views

Can I embed a custom font in an iPhone application?

I would like to have an app include a custom font for rendering text, load it, and then use it with standard UIKit elements like UILabel. Is this possible?
Airsource Ltd's user avatar
776 votes
20 answers
399k views

How do you trigger a block after a delay, like -performSelector:withObject:afterDelay:?

Is there a way to call a block with a primitive parameter after a delay, like using performSelector:withObject:afterDelay: but with an argument like int/double/float?
Egil's user avatar
  • 8,141
774 votes
20 answers
385k views

How do I create delegates in Objective-C?

I know how delegates work, and I know how I can use them. But how do I create them?
Andy Jacobs's user avatar
  • 15.2k
771 votes
34 answers
200k views

Eliminate extra separators below UITableView

When I set up a table view with 4 rows, there are still extra separators lines (or extra blank cells) below the filled rows. How would I remove these cells?
RoundOutTooSoon's user avatar
769 votes
14 answers
236k views

Hide strange unwanted Xcode logs

When using the Xcode 8+ and creating a new blank project, the following logs appear when running the application: 2016-06-13 16:33:34.406093 TestiOS10[8209:100611] bundleid: com.appc.TestiOS10, ...
Hans Knöchel's user avatar
769 votes
28 answers
816k views

How to link to apps on the app store

I am creating a free version of my iPhone game. I want to have a button inside the free version that takes people to the paid version in the app store. If I use a standard link http://itunes.apple....
754 votes
63 answers
392k views

Placeholder in UITextView

My application uses an UITextView. Now I want the UITextView to have a placeholder similar to the one you can set for an UITextField. How to do this?
731 votes
78 answers
323k views

Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7

Starting in iOS7, there is additional space at the top of my UITableView's which have a style UITableViewStyleGrouped. Here is an example: The tableview starts at the first arrow, there are 35 pixels ...
esilver's user avatar
  • 28.1k
710 votes
45 answers
196k views

This action could not be completed. Try Again (-22421)

I am trying to upload an Apple TV App to the App Store for testing purposes, but I got the issue: This Action could not be completed. Try Again (-22421) as in the below image: So what can I do?
Nimisha Ranipa's user avatar
706 votes
7 answers
186k views

Version vs build in Xcode

I have an app that I developed with Xcode 3 and recently started editing with Xcode 4. In the target summary I have the iOS application target form with fields: identifier, version, build, devices, ...
chris's user avatar
  • 16.4k
690 votes
30 answers
297k views

How do I test if a string is empty in Objective-C?

How do I test if an NSString is empty in Objective-C?
Jamey McElveen's user avatar
686 votes
43 answers
188k views

iOS 8 UITableView separator inset 0 not working

I have an app where the UITableView's separator inset is set to custom values - Right 0, Left 0. This works perfectly in iOS 7.x, however in iOS 8.0 I see that the separator inset is set to the ...
user3570727's user avatar
  • 10.2k
671 votes
38 answers
438k views

Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

Just started using Xcode 4.5 and I got this error in the console: Warning: Attempt to present < finishViewController: 0x1e56e0a0 > on < ViewController: 0x1ec3e000> whose view is not in the ...
Kyle Goslan's user avatar
  • 10.9k
670 votes
34 answers
355k views

iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

This crash has been a blocking issue I used the following steps to reproduce the issue: Create a Cocoa Touch Framework project Add a swift file and a class Dog Build a framework for device Create a ...
vladof81's user avatar
  • 26.4k
656 votes
9 answers
177k views

What does the NS prefix mean?

Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean?
Martin08's user avatar
  • 21.2k
649 votes
28 answers
345k views

Presenting modal in iOS 13 fullscreen

In iOS 13 there is a new behaviour for modal view controller when being presented. Now it's not fullscreen by default and when I try to slide down, the app just dismiss the View Controller ...
pascalbros's user avatar
  • 16.4k
641 votes
22 answers
420k views

UITextField text change event

How can I detect any text changes in a textField? The delegate method shouldChangeCharactersInRange works for something, but it did not fulfill my need exactly. Since until it returns YES, the ...
karim's user avatar
  • 15.5k
639 votes
52 answers
235k views

Xcode 6 Bug: Unknown class in Interface Builder file

I upgraded to Xcode 6 beta 4 and now my App continuously crashes with the message Unknown class X in Interface Builder file. It crashes because supposedly Xcode can't find my custom classes that I ...
Epic Byte's user avatar
  • 33.9k
637 votes
18 answers
306k views

How to tell if UIViewController's view is visible

I have a tab bar application, with many views. Is there a way to know if a particular UIViewController is currently visible from within the UIViewController? (looking for a property)
Rob Bonner's user avatar
  • 9,346
633 votes
6 answers
415k views

Send and receive messages through NSNotificationCenter in Objective-C?

I am attempting to send and receive messages through NSNotificationCenter in Objective-C. However, I haven't been able to find any examples on how to do this. How do you send and receive messages ...
user avatar
625 votes
35 answers
366k views

UIScrollView Scrollable Content Size Ambiguity

Fellow devs, I am having trouble with AutoLayout in Interface Builder (Xcode 5 / iOS 7). It's very basic and important so I think everyone should know how this properly works. If this is a bug in ...
Wirsing's user avatar
  • 6,773
614 votes
21 answers
396k views

Giving UIView rounded corners

My login view has a subview which has a UIActivityView and a UILabel saying "Signing In…". This subview has corners which aren't rounded. How can I make them round? Is there any way to do it inside ...
itsaboutcode's user avatar
  • 24.8k
612 votes
27 answers
383k views

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

I am facing the Problem when I have updated my Xcode to 7.0 or iOS 9.0. Somehow it started giving me the Titled error "The resource could not be loaded because the App Transport Security policy ...
Manab Kumar Mal's user avatar
606 votes
6 answers
240k views

What are Unwind segues for and how do you use them?

iOS 6 and Xcode 4.5 has a new feature referred to as "Unwind Segue": Unwind segues can allow transitioning to existing instances of scenes in a storyboard In addition to this brief entry in Xcode ...
Imre Kelényi's user avatar
598 votes
32 answers
385k views

iPhone UITextField - Change placeholder text color

I'd like to change the color of the placeholder text I set in my UITextField controls, to make it black. I'd prefer to do this without using normal text as the placeholder and having to override all ...
adam's user avatar
  • 22.5k

1
2 3 4 5
13746