cocoa-touch

Why is finished always zero/NO when an animation ended and the delegate-method from the didEndSelector is called?

My delegate for ended animations looks like this: (void)animationDidEnd:(NSString *)animationID finished:(BOOL)finished context:(void *)context for some reason, the finished is always NO in my animation chain. But I need to know if an animation in my chain has finished completely. Example: Something says: "move to (20,100)". And as ...

Best practices for storing data iPhone Apps

I've a iPhone App that relies heavily of TableViews and SQLite database. Where do you store the data? In my case I pull data from the web in App Delegate and store it in AppDelegate and save it to DB at regular intervals. The rootviewcontroller is a tableview that reads the appdelegate object and populates itself. But, according to Eva...

Changing the background color of a UIAlertView?

I want to change the background color of my UIAlertView, but this doesn't appear to have a color attribute. ...

UIWebView redirect to facebook login page

UiWebView redirect its self to already login page.i want to stop redirect? I want web view to reload login page and ask for username and password.Clear context and load request again. NSString *urlAddress = [NSString stringWithFormat:@"http://www.facebook.com/login.php?]; //Create a URL object. NSURL *urld = [NSURL URLWithString...

Loading UINavigationController from another nib automatically by UITabBarController

I think I've found the cause: Document Info window in IB has a warning: "'Selected Navigation Controller (Second)' has nib name property set to 'SecondView.nib', but this view controller is not intended to have its view set in this manner." Bummer. I've built nib in Interface Builder that has UITabBarController at top level and switc...

How to get transition like Star Trek app?

I've modified the ViewTransitions app to use kCAScrollHorizontally. I've set transition in the app delegate to use kCATransitionPush rather than kCATransitionFade. However, I still get fading in and out. How can I get the views to slide in landscape just like the Star Trek app (http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoft...

Where can I get better Apple documentation?

More often than I'd have hoped I seem to come across method/property definitions in Apple's documentation that are vague at best and meaningless, to me, at worst. For example, take the following method description from NSNumberFormatter Class Reference: setPartialStringValidationEnabled: Sets whether partial string validation ...

Easy way to set a single character of an NSString to uppercase

I would like to change the first character of an NSString to uppercase. Unfortunately, - (NSString *)capitalizedString converts the first letter of every word to uppercase. Is there an easy way to convert just a single character to uppercase? I'm currently using: NSRange firstCharRange = NSMakeRange(0,1); NSString* firstCharacter = [da...

pushViewController debugging

I am trying (from my 3rd child in the heirachy) to load the root view with the following. This does not work and I get the following error when the below code is run. -[DetailViewController clickButton:]: unrecognized selector sent to instance 0x1161e00' Code: MapViewController *dvController = [[MapViewController alloc] initWithNib...

How to play iPhone tap sound?

I have a button in my iPhone app that I'd like to have play the default "keyboard tap" sound when it's tapped. I've been able to play my own custom sounds easily enough, but is there any way to play a default system sound like this in my app? ...

UIScrollView not scrolling when set to a tableView's tableHeaderView

Hey everyone, I'm having difficulty scrolling a UIScrollView instance in my UITableView when I set it as a tableHeaderView. It still responds to touch events it appears, but doesn't wish to scroll horizontally. I've tried explicitly setting to setUserInteractionEnabled:YES without much luck. Is there something in particular I need to...

UIImageView subclass duplicate the image

Hi I am working on a subclass of UIImageView and one of the things I require is when the object is initalised with the initWithImage: message a 'copy' is created. I must be confusing something because I can't see what is not working here.. - (id)initWithImage:(UIImage *)image { [image retain]; if (self = [super initWithImage:image]) {...

UITextView and UIPickerView with its own UIToolbar

I like to replicate the form behavior of Safari on the iPhone in my own app. If you enter data in an web form you get a separate UIToolbar (previous, next, done) just above the UIKeyboardView. Same for choosing an option: you get the same UIToolbar just above an UIPickerView. I am looking for demos / sourcode / ideas how to implement th...

How to set UIcolor to deep blue

Hello, How can I set UIcolor to have a deepblue values (like 330099, shown in interface builder) programmatically? Thanks. ...

Core data managed objects with extra ivars and methods...

Is it ok to add ivars and methods to an instance of NSMangaedObject? By "extra", I mean ivars that you don't want serialized. Do I just add them to my NSMangaedObject subclass like any other class or do I have to take any extra precautions? ...

How can I load a NIB that isn't a view in a UITabViewController?

I want to load a nib that isn't a view in a UITabViewController. Here's what I have now and it isn't working, but it should give you an idea of what I want: - (IBAction)PlaylistButtonPressed:(id)sender { MusicPick *music = [[MusicPick alloc] initWithNibName:@"MusicPick" bundle:nil]; [self.view addSubview:music.view]; [mus...

What's the most optimal way to get a random floatingpoint number between floatA and floatB?

I have an interval consisting of two float numbers, and need to generate 20 random numbers in a look that are somewhere inbetween this interval defined by the two floats. Lets say, for example: float a = 12.49953f float b = 39.11234f float r = //best way to get best randomly numbers between a and b The random number may be == a and =...

What's the easiest way of implementing own functions that are used all over the place in an large project?

I want to create a set of functions, that make life easier. I use them in about 60% of all project files. I wonder what's the most efficient way of including these in the project. I think about creating one file where they go in and including this file in every file where I need them. On the other hand, it would be cool if I can include...

Hide keyboard when losing focus off UISearchBar

Hi, I'm not sure why this is so hard. I have a UISearchBar at the top of my page. When the user types into that UISearchBar, it will automatically filter the results in the UITableView that is below the search bar. There is no need for a Search button since I search when keys are pressed. The flow of the application is that the user ty...

What's better: Writing functions, or writing methods? What costs more performance?

Currently I am making some decisions for my first objective-c API. Nothing big, just a little help for myself to get things done faster in the future. After reading a few hours about different patterns like making categories, singletons, and so on, I came accross something that I like because it seems easy to maintain for me. I'm making...