cocoa-touch

Creating Nsmutable array from xml feed

hi everybody. I want to copy items in BlogEntries into my custom Nsmutable Array. The code is -(void) grabRSSFeed:(NSString *)blogAddress { // Initialize the blogEntries MutableArray that we declared in the header blogEntries = [[NSMutableArray alloc] init]; // Convert the supplied URL string into a usable URL object NSURL *...

Calculate the height of a UITextView's text with sizeWithFont:constrainedToSize:lineBreakMode doesn't seem to return correct results

Hey, I'm trying to calculate the height of the text constrained by a UITextView but it doesn't seem to return correct results. Here is my code : - (void)textViewDidChange:(UITextView *)aTextView { CGSize textSize = [aTextView.text sizeWithFont:aTextView.font constrainedToSize:aTextView.frame.size lineBreakMode:UILineBreakModeWordW...

UIImagePNGRepresentation() and scale (iPhone 4 screen)

I've got some image generating code that uses UIGraphicsBeginImageContext(), UIGraphicsGetImageFromCurrentImageContext() and UIImagePNGRepresentation() to do some drawing, then save it to disk as a PNG for later use. Does UIImagePNGRepresentation() take into account scale? As in, if I have an image that is 20 points wide, will the resul...

Making sure that objects in nibs are initialized before applicationDidFinishLaunching

Hello, and thanks for taking a look at my problem. i have two view controllers in my app and each has its own nib file. an instance of controller1 is stored in MainWindow.xib and an instance of controller 2 is in Controller1.xib. is there a way to make sure that controller 2 is initialized before the app delegate is sent applicationD...

How to release an instance variable which will be returned to the caller?

-(NSMutableArray *)processResult:(NSArray*)matchArray removeString:(NSString *)removeStr{ NSString *newLink; NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:[matchArray count]]; //doing sth to result return result; } In this scenario, as the result variable will be returned to the call...

UIView (subview) does not send IBActions to AppDelegate.

I'm having this problem because I originially made everything in the main NIB, but then after reading learned that it is better to use subviews. I've got my IBActions in the AppDelegate, and I've successfully connected and loaded my subviews. However, when I try to connect my buttons in the subviews to the IBActions in the AppDelegate,...

Problem of UIWebView in cocos2d. The View is appearing in next scene also.

hi, I am using UIWebView to display the scrolling text in a scene in cocos2d. Some times the text is appearing in the next scene also. And it is not disappeared in any next scene. When I restart the game it is again fine. I released it and removed it from superview. But the problem occurs only some times . I could not get where I am wro...

representing people iOS

This is a "is it best to use the address book" question. As part of an app for iOS 4.0 I'm writing, I want to represent that a person has requested something. How I was wanting to do this is allow the user to select a person from their address book using the AddressBook.framework. What I would like to know is whether this is the best a...

Enhance appearance of UINavigationBar

I would like to know how to enrich the appearance of controls such as UINavigationBar, UITabBar, UIToolBar, back-buttons to make them look more 'physical'. I made some tricks with custom views sliding in and out with a nice image in it but what I want is to customize those standards controls so they look like in those amazing apps Apple ...

How do I determine the distance the user has traveled when designing a pedometer application?

I'm designing a pedometer application for the iPhone. Given the number of steps a user has taken, how do I determine the distance in miles they have traveled? ...

creating view without interface builder(iphone)

How to create view without interface builder? ...

Move programmatically cursor in UiTextField

Hi, I need to tweak UiTextField behavior so that I can programmatically insert some asterisks and move the cursor at the beginning of the string; I tried the "paste" trick (http://dev.ragfield.com/2009/09/insert-text-at-current-cursor-location.html), but the cursor is moved at the end. The effect I try to achieve is like this: At the sta...

sorting NSMutableArray weird results with Core Data

Hi all, I have been going over this for hours and cannot find the problem. I have an array of scores which I save at the end of a game in a core data model. After saving when I go back into the high scores viewcontroller I load the scores from core data and sort the array using the following function where scores array is an NSMutableA...

XCode Documentation - Offline Reading

Is it possible to have the iOS and OSX documentation available for offline reading? If so, how? ...

How to auto-resize UIView proportionally?

I have a UIView whose height should always be exactly 1.5 times the width. When the view is auto-resized (in this case, because the iPhone is rotated), this proportion gets messed up. How can I make sure the height/width ratio doesn't change as the view resizes? ...

Modifying/Animating a UISplitView on iPad - Navbar issues

I am creating an iPad application using a UISplitView. I used the default template for that type of application in Xcode. The UISplitView has a left pane (menu or list) and a right pane (detail or content view) in it. Each has a navigation bar at the top of the view. What I want to do is move (with animation) both views to the left so t...

Howto get UISlider to respond to tap events on the track above and below the thumb slider

I have a 284 pixel wide UISlider with a range of 0-25. The user needs to select a value to 1 decimal place (say 12.3), which is possible with care by rolling your finger, but is fiddly and tends to change value as you lift your finger. I am trying to arrange it so that you can inch the slider up or down by 0.1 intervals by tapping on t...

Is there a graphical error in iPhone SDK 4 Cocoa Touch toolbars?

Add a toolbar to a view in Interface Builder, and then add buttons to the toolbar. Image buttons on a toolbar glow/highlight when they are tapped, to give the user a response that they touched it. Ever since iPhone SDK 4 however, when tapping buttons in a toolbar, the glow is the correct size, but with every tap the glow gets progressi...

How can I add a subview to the bottom of a UITableView?

I am using the EGOTableViewHeader class provided from: http://www.drobnik.com/touch/2009/12/how-to-make-a-pull-to-reload-tableview-just-like-tweetie-2/ I am able to display my view at the top of my UITableView: refreshHeaderView = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.heigh...

Need clarification on addObjectsFromArray function

I have the following code (both items and itemsCopy are NSMutableArray's): //DO: populate items w/ 30 elements [self.itemsCopy addObjectsFromArray:self.items]; //DO: remove all elements in items Results Begin Pass 1: itemsCopy = 0 items = 30 End Pass 1: itemsCopy = 30 items = 0 Begin Pass 2: itemsCopy = 0 items = 30 End Pass 2: it...