cocoa-touch

Detecting discrete touch events

How do I isolate touch events from each other? For example, I have one method that should be called if the view detects a single tap, and another method that should be called if the view detects a double-tap. The problem with the way I'm doing it is that a double-tap is always interpreted as a single tap before it is intereperted as a do...

Resize UIImageView in UITableViewCell upon rotation

I'm setting a UIImageView into my table cells during - (UITableViewCell *)tableView:(UITableView *)tableVw cellForRowAtIndexPath:(NSIndexPath *)indexPath They are stretchable images (created with stretchableImageWithLeftCapWidth) How can I update their size when my table view is rotated to another orientation? ...

How to set the line break in Xcode label?

Hi, everyone, I want to ask an stupid question about the Xcode. I use the .xib to add a Label to my interface and I type something in the Label. For example, Hello World. How can I set the 2 words or 3 words in different lines? Example: Hello World // I don't want this Hello // this is correct World Thank you very much. ...

Cocoa Touch - Tab Bar App

How can I add a tab bar to my view based app? All the tutorials are older and use a diffrent xcode so its hard to follow along... Instead of using a controller can I just hook up an IBAction to it.. ...

UIWebView scrolling weirdness

Ok I have a UIWebView and a text field on a very simple viewcontroller (fresh project for testing). The webview opens up google.com on load and when the text field becomes first responder, I have the webview resizing so the content doesn't display underneath the keyboard. The resize is fine, but it appears the content of the control is s...

How can I resize a sprite image programmatically according to the position of the image.

Hi I have 10 images a ball of same size. I need to show the ball animation. The ball animation should start image1 and should end with image10. I want to show that the ball is travelled far from the throwing position. So, I need to show that the images at the end of animation are small. For this I manually resized the images of the ball...

How to get proper UIInterfaceOrientation from a nested UIViewController

When I place a view controller's view inside a top level view controller, the UIInterfaceOrientation I get from the nested view controller is incorrect. If I get the orientation from the top level view controller, I get the correct one. The interfaceOrientation property is readonly, so I can't simply set it. How can I get my nested view ...

How can we run CCAction of classA in classB ? What method can we use for it ?

Hi, I have CCAction *action1; in classA. I need to use that action in classB. I need to run action1 along with other actions in classB. How can I do that ? I did in the following way but not working. warning: 'CCAction' may not respond to '+actionWithAction:' Here are my classA and classB. @interface classA : CCLayer { CCAction...

UITableView: delete section controls

Hello, Is there a way to add delete controls, like in UITableViewCell, on a table section? I see two ways: Use table cell instead of sections. Write own UIView section class, which will show delete controls. Regarding the first way - as I think, it could be an easiest way in my situation. The second way may be better from the imple...

Cocoa Touch - Landscape View

How can I keep my app ONLY in landscape when its using the tab bar templete? ...

object interface layout?

Previously I used to write my object interfaces like this: // VERSION 1.0 @interface Planet : NSObject { NSString *name; NSString *type; NSNumber *mass; } @property(nonatomic, retain) NSString *name; @property(nonatomic, retain) NSString *type; @property(nonatomic, retain) NSNumber *mass; -(NSString *)description; @end Bu...

timeIntervalSinceNow returning negitive numbers

timeInterval keeps returning random numbers. Some positive. I would think the interval would continue increase with each call, but sometimes I get negative numbers or positive numbers. NSDate *date = groceryItem.lastPurchased; double timeInterval = [date timeIntervalSinceNow]; cell.detailTextLabel.text = [NSString stringWithFormat:@"%d"...

Rotation of NIBs

I've been digging at this for a few days and can't seem to figure it out. My app launches in landscape and supports only landscape orientations. Works fine. My app delegate instantiates a root view controller, view is built from an XIB and populated with an image in viewDidLoad. The underlying image is landscape size (1024x768). Looks ...

Cocoa Touch - Send Messages to Xbox 360 Friends

For my new app Im working on I want to be able to send messages on the app to xbox 360 friends . I Know its possible since they have them on the app store but how would I do it? Thanks for any ideas/code! ...

Quartz 2D Drawing String in Rect, how can I get an ellipsis?

[infoText drawInRect:CGRectMake(10, 10, 310, 40) withFont:infoTextFont lineBreakMode:UILineBreakModeWordWrap]; Any suggestions on how to produce an ellipsis when the text exceeds the size of the rect? ...

Text Highlight in PDF using UIWebView

Hi, I am developing an app which highlights/selects a word when user holds tap on the word and translates selected word. It is working perfectly with HTML pages. However, my app also supports pdf documents. The problem is that text doesn't get selected when viewing PDF's, instead the zoom magnifier is shown. By the way, I am using "Jav...

Subclassing TableViewCell, backgroundView and selectedBackgroundView mystifying me

I'm subclassing UITableViewCell and using Quartz 2D to draw the elements of the cells in the drawContent view method. In my table view delegate's tableView:cellForRowAtIndexPath, I'm also inserting a UIImageView as a subview to the cell, but the image doesn't appear until the cell is selected. I'm suspicious of the backgroundView and s...

iPad page sheet rendered with no background (bug?)

Hi, In my iPad app, I am presenting a modal view controller with the UIModalPresentationPageSheet style. Today, randomly, when I presented the modal view controller, the page sheet was rendered without the white background, leaving just the shadow: I have not made any changes to the view controller that is being presented, or the vie...

Disable Holidays from a UIPickerView on iPhone

How can I disable specific dates from a UIPickerView that's .datePickerMode has been set to UIDatePickerModeDate? I need to disable holidays and weekends. ...

How to change the title of the backbaritem in uinavigationcontroller

In my code, i have this line; [self.navigationItem.backBarButtonItem setTitle:@"back"]; but this doesn't change the title of the back button in uinavigationcontroller when the new controller is pushed. So how to change the title of the back button? ...