Questions tagged [cocoa-touch]

The Cocoa Touch Frameworks that drive iOS apps share many proven patterns found on the Mac, but were built with a special focus on touch-based interfaces and optimization.

Cocoa Touch is Apple's application-development framework for , consisting of Foundation, UIKit (), and Core Data ().

The Cocoa Touch frameworks that drive apps share many proven patterns found on the , but were built with a special focus on touch-based interfaces and optimization.

For development, see .

For Cocoapods, see .

Many Cocoa Touch questions deal with , , , or .

Debugging techniques

Cocoa programs can be debugged with many techniques and tools, both general and specific to , , , and .

Apple's Technical Note about debugging iOS applications

34585 questions
20
votes
2 answers

presentModalViewController in iOS6

In my app's code I am still presenting viewcontrollers modally with presentModalViewController. This is deprecated in iOS 6. Does that mean this method has no effect on devices running iOS 6? If yes, how can I make my app present viewcontrollers…
user975561
  • 514
  • 1
  • 6
  • 17
20
votes
2 answers

Assign empty string only if variable is nil (ternary operator)

I'm trying to achieve the equivalent of the following C# code: someStringValue = someStringValue ?? string.Empty; Where if someStringValue is null, a value of string.Empty (the empty string: "") will be assigned. How do I achieve this in…
alan
  • 6,705
  • 9
  • 40
  • 70
20
votes
3 answers

Customising the font/background colour of index/section bar in UITableView

I've read in another thread on SO that you can adjust the font or background colour of the index bar (that is the A-Z # scrollbar) in a UITableView adding a CALayer. My app will be running on iOS 5 and above and since I haven't seen anything about…
sooper
  • 5,991
  • 6
  • 40
  • 65
20
votes
9 answers

How to get UIMenuController work for a custom view?

I'm trying to get the following code work: UIMenuController * menu = [UIMenuController sharedMenuController]; [menu setTargetRect: CGRectMake(100, 100, 100, 100) inView: self.view]; [menu setMenuVisible: YES animated: YES]; The menu instance is…
al_lea
  • 596
  • 1
  • 9
  • 17
20
votes
4 answers

Labels aligning in UITableViewCell

I use UITableView with cells created using UITableViewCellStyleSubtitle. Every cell's height is dynamically adjusted using the - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath delegate method. The…
Igor
  • 1,258
  • 2
  • 14
  • 20
20
votes
4 answers

Remove beginning and trailing new line characters from NSString

How can one remove only the beginning and trailing new line \n from a NSString. For e.g. @"\n\n\n\Hi\nHow are you\nToday.\n\n\n\n" output: @"Hi\nHow are you\nToday." Thanks.
southpark
  • 541
  • 2
  • 5
  • 19
20
votes
4 answers

Registering GPX (or XML) file to open in iOS app

I am having trouble opening GPX files in my iOS app. I registered the extension and some files open correctly, that is when I tap on a link to GPX file in Safari, it shows a prompt asking me which application I want to use to open the file. Then I…
MirekE
  • 11,515
  • 5
  • 35
  • 28
20
votes
10 answers

Setting hidesBottomBarWhenPushed leaves bottom bar missing after View Controller is popped

I have the following setup: A tab bar app. On one tab there is a navigation controller. My workflow: When I push a new viewController onto the navigation controller stack, I set the hidesBottomBarWhenPushed property. This works great, the tab bar is…
Corey Floyd
  • 25,929
  • 31
  • 126
  • 154
20
votes
6 answers

How can I set the default state of a UISegmentedControl?

Is there a way to set the starting selected segment in a UISegmentedControl in Interface Builder, or do I have to do it in the code? If it's in the code, is viewDidLoad the best place to set it?
nevan king
  • 112,709
  • 45
  • 203
  • 241
20
votes
4 answers

UIPanGestureRecognizer on UITableViewCell overrides UITableView's scroll view gesture recognizer

I've subclassed UITableViewCell and in that class I apply a Pan gesture recogniser: UIPanGestureRecognizer *panning = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePanning:)]; panning.minimumNumberOfTouches =…
sooper
  • 5,991
  • 6
  • 40
  • 65
19
votes
1 answer

Is -[UITableView reloadData] asynchronous or synchronous?

When you call -reloadData on a table view instance, does it make all UITableViewDataSource calls async? Thank you.
the Reverend
  • 12,305
  • 10
  • 66
  • 121
19
votes
1 answer

Set Objective-C property by string

I'm wondering if there's an easy way to set (or retrieve) an Objective-C property by a NSString... It is possible to use NSSelectorFromString, but I'd like an easier (and less hacky way) to do it... Something like [object…
sleepy_keita
  • 1,488
  • 4
  • 17
  • 26
19
votes
4 answers

Way to make a UIButton continuously fire during a press-and-hold situation?

You know how Mario just keeps running to the right when you press and hold the right-button on the D-Pad? In the same manner, I want my UIButton to continuously fire its action for the duration that it is held down. Is this possible for a UIButton?…
RexOnRoids
  • 14,002
  • 33
  • 96
  • 136
19
votes
6 answers

Remove the inner shadow that UIPopoverController creates

I am creating a custom layout of the popover that iOS provides. I have subclassed the UIPopoverBackgroundView and got it to draw the background for my popover correctly. My problem is now that UIPopoverController creates an inner shadow on the…
Sorig
  • 1,200
  • 11
  • 24
19
votes
13 answers

Stop UITextView from jumping when programmatically setting text

I have to update a small amount of text in a scrolling UITextView. I'll only be inserting a character where the cursor currently is, and I'll be doing this on a press of a button on my navigation bar. My problem is that whenever I call the setText…
Michael Waterfall
  • 20,497
  • 27
  • 111
  • 168