cocoa-touch

duplicate the safari tab view switching functionality with the iphone sdk

I would like to duplicate the view switching functionality found in mobile safari's tab feature. I have implemented the scrollview containing the view screenshots, however, when a view is selected how would I duplicate the zoom animation and the title and toolbars appearing and vice-versa? ...

How to let the CCSprite handles Touch event?

I created my OwnCCSprite, and it get the implemented CCStandardTouchDelegate protocol, and ccTouchesBegan event. But it seems not working. When I click the CCSprite, the ccTouchesBegan in the CCLayer is called, but the CCSprite's ccTouchesBegan can't called. How can I detect the CCSprite is being touched in CCLayer / OwnCCSprite? or I ne...

How to retrieve the location of a control on the view?

I have a button on a view, I want to add another button next to it when the first button is touched. Therefore I need it's top left corner to do the math. Here's what is puzzling me greatly: // this code is executed when the button is pressed NSLog(@"X:%f",moreButton.frame.origin.x); that returns on the first and second click the foll...

Core Text's CTFramesetterSuggestFrameSizeWithConstraints() returns incorrect size everytime

According to the docs, CTFramesetterSuggestFrameSizeWithConstraints () "determines the frame size needed for a string range". Unfortunately the size returned by this function is never accurate. Here is what I am doing: NSAttributedString *string = [[[NSAttributedString alloc] initWithString:@"lorem ipsum" attributes:nil] autorele...

Creating a Custom UIButton.

I am looking to create a Custom UIButton (not subclass) progrmatically, I would like it to have a background image that will stretch as the UIButton's width increases. How would I do this? ...

Get back original size (height, width) from UIImage load with imageWithData

I just cant find useful information from web. I have an UIImage which loaded from sqlLite with method imageWithData(NSData*), I just find the height and width of the size both be zero. I wanna get back the original height and width of the image, is it possible? or I do need to store these information separately in sqllite? ...

iPhone zoom to userLocation

Hi, I need help making my iPhone app zoom to the users current location. I have seen this answered before on StackOverflow ( http://stackoverflow.com/questions/2423236/zoom-on-userlocation )but I have no idea what I am doing when it comes to iPhone development (I make websites not iPhone apps). I need it explained extremely simply, dow...

How can I dismiss the view appeared by touching Add item in UINavigationController ?

I have added add(+ symbol button) button to my navigation controller. When I click it a view appears from bottom. I added a navigation bar and two buttons to it. One save and one cancel button. And the view have one textEdit box. After editing I can save or cancel. If I touch cancel I need the view to disappear like it should go dow...

Easiest Way to Parse data from twitter with Cocoa

Hello, I've followed the tutorial from here: Twitter Client Tutorial to make a little twitter app. Now I need to find out how to parse the XML twitter gives you when you make a request. I've looked at tons of tutorials on phrasing xml on the iPhone but none have made much sense because Im still new to cocoa. Twitter stores the text of t...

Which pattern should be used for editing properties with modal view controller on iPhone?

I am looking for a good pattern for performing basic property editing via a modal view on the iPhone. Assume I am putting together an application that works like the Contacts application. The "detail" view controller displays all of the contact's properties in a UITableView. When the UITableView goes into edit mode a disclosure icon i...

how can stop creating duplicates in camera roll while using UISaveVideoAtPathToSavedPhotosAlbum to save videos in camera roll?

I have a video in applications documents folder. I need it to be saved in camera roll. So, I used UISaveVideoAtPathToSavedPhotosAlbum method to save it in camera roll. It's working and I can see the video added to camera roll. But, the problem is every time I execute the application with same video(with same file name), it is added an...

UTF-8 conversion

Hey guys, I am grabbing a JSON array and storing it in a NSArray, however it includes JSON encoded UTF-8 strings, for example pass\u00e9 represents passé. I need a way of converting all of these different types of strings into the actual character. I have an entire NSArray to convert. Or I can convert it when it is being displayed, wh...

One label, two different fonts?

I need to format text in a label like this: username: some text from this user. This will create additional lines of text that will go on and on and on. Where "username" is bold. This will go into a UILabel, which is in a custom table cell. Is there a way to get this type of layout? ...

nsfetchedresultscontroller with empty sections

I have a database of People and pets, with a one to many relationship Person Pet Name Name Pet <----->> Owner I am using a UITableView backed by Core data and a nsfetchedresultscontroller to display the list of pets, grouped into sections by the owner. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]...

UIViewController as statemachine?

I want to have a general controller that acts as an abstract statemachine (not have any views/bars etc. of its own). Is the UINavigationController meant for this too? ...

Copying contents from one NSMutableArray to another

I have two NSMutableArrays: NSMutableArray* currentMessages NSMutableArray* items I am trying to copy the contents of items into currentMessages as such: [self.currentMessages addObjectsFromArray:self.items]; When I am debugging self.items contains 30 objects. After this operation self.currentMessages contains 0 objects. Why is th...

How do I define constant values of UIColor?

I want to do something like this, but I cannot get a cooperative syntax. static const UIColor *colorNavbar = [UIColor colorWithRed: 197.0/255.0 green: 169.0/255.0 blue: 140.0/255.0 alpha: 1.0]; I suppose that I could define macros, but they are ugly. ...

how to hide some properties using ABPeoplePicker

greetings! when using peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person, a view with all of the contact's information is shown. I've seen apps which only display selected info only (e.g. phone numbers) how can I do this? I only want to display the ...

NSNumberFormatter to display custom labels for 10^n (10000 -> 10k)

I need to display numbers on a plot axis. The values could change but I want to avoid too long numbers that will ruin the readability of the graph. My thought was to group every 3 characters and substitute them with K, M and so on (or a custom character). So: 1 -> 1, 999 -> 999, 1.000 -> 1k, 1.200 -> 1.2k, 1.280 -> 1.2k, 12.800 -> 12.8k,...

handling same touch event with multiple control (parent and child)

I need to handle a touch event on my custom uiviewcotroller. I have a sub controller within the view that already handle touch event (it's a plot that handle zooming and scrolling). I want to make a tabbar disappear when I tap the screen once. Actually it only works (even tought the tabbar doesn fade away but simply is no visible) in the...