objective-c

Passing a Property to a function and setting the value to be retained

I have two properties setup as ViewControllers that each use different NIB file. (Male and Female Models, will function the same but are setup visually different.) I want to have one function to create the ViewController based on the NIB Name and ViewController I pass in. What's happening is the ViewController property is not being r...

Setting font and font-size of title bar text in a UITableViewController

I have a simple navigation based application for the iphone/objective-c within various UIViewControllers that are pushed into view, I can set the text in the title bar using something like self.title = @"blah blah blah" Is there a way to control the font and font-size of the title in the title bar text? thanks! ...

Caption update on button causing IPhone app to crash

Hello, I'm currently teaching myself Objective-C and Iphone Development using the very good 'Begining IPhone Development'. I have been playing around with one of the sample applications and I am trying to update one button with text from a text field when another button is pressed. I have set up my Actions and links and all that jazz....

iPhone and NSUserDefaults

In my viewWillLoad: method I'm currently doing something along these lines: - (void)viewWillAppear:(BOOL)animated { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ( [defaults boolForKey:@"enabled_preference"] ) { ... } else { ... } [super viewWillAppear:animated]; } If I build and...

Blog for learning Objective-C

Are there any blogs dedicated to Objective-C and iPhone development? ...

Using a category in a dylib to extend a binary's class

Hello, I have an objc app that has the class Foobar and I want to make a dylib that will be loaded into that app on start and extends the class Foobar with a few methods. Unfortunately I cannot build the library, I get the following linker error: "_OBJC_CLASS_$_Foobar", referenced from: __objc_const@0 in Foobar+MyStuff.o ...

Objective-C performSelector when to use colon?

Do you only postfix the method name with a : if you are calling a foreign object? For some reason [self performSelector:@selector(myMethod:) withObject:nil afterDelay:5]; Does not work but [self performSelector:@selector(myMethod) withObject:nil afterDelay:5]; Does! EDIT: Declared in the implementation of a class but not the int...

Objective-C: call a method you just created

Hi guys, Simple question, as I am coming from another programming language. In Objective-C, lets say in a controller class I want to separate certain code into its own method, how do I call that method let's say, from viewLoad. As an example, let's say I create a method: (void)checkIfInputCorrect { NSLog(@"text"); } Now, i wanted to...

Why isn't SEL a class in Objective-C?

In Objective-C (at least, the Apple flavor of Obj-C), why is SEL not a class? Is it a matter of efficiency? Is it to prevent some sort of infinite recursion? Was there merely no incentive to make SEL a class? Speculation welcome, but please let me know if an answer is historical truth or speculation. ...

Calling an NSAlert from didEndSelector of another NSAlert

I need to bring up an NSAlert based on the response from another NSAlert. However, when I try to call it from the didEndSelector of the first one, all kinds of nasty things happen (like my document window disappearing and warnings about ordering problems printing to console). Any thoughts? ...

how to run my application in background in iphone?

i want to run my timer in background even when app is not running.because i want to get gps cordinate of the user after some time interval.waht is the method to do this? ...

Objective-C can't use stringWithContentsOfURL data in IF statement

Hey, I'm trying to ping my server and check the version of the app - all goes well so far: NSURL *url = [NSURL URLWithString:@"http://thetalkingcloud.com/static/ping_desktop_app.php?v=1.1"]; NSError *theNetworkError; NSString *content = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&theNetworkError]; ...

Copy a file from iPhone sandbox to Desktop?

Hi all, I am developing an iPhone app for uni and we create an sqlite database file within the iPhone's sandbox directory. Our application writes internally to this file, I am wondering how it would be possible to get this file back to my desktop. I don't really mind how it can be done, any way is fine. Maybe it is possible to even do ...

didReceiveData of NSMutableUrlRequest never triggered

Hi I’m new in iphone development world and I’m trying to call a web service using the HTTP method POST. To do that I'm using the NSMutableUrlRequest. My problem is that the DidReceiveData delegate is never called and the NSUrlConnection doesn’t return null. Here is my code : - (void)connection:(NSURLConnection *)connection didRecei...

NSData Behaving as a Consumable Data Stream. Possible?

I am currently doing a lot of data wrangling. I ingest a lloonngg NSData byte streams and then parse that data. The parsing is trivial. However, I have to simulate consumption of the data as I parse via not particularly elegant bookkeeping. Here is what a typical method looks like in the category of NData I have implemented: // Grab a l...

IBAction gets stuck in Loop.

Ok, I have an IBAction that syncs with iCal and is also triggered by KVO of the 'name' property in my CD Model, so that when the property changes the Action is triggered. What happens is that once the IBAction reaches the end it skips to the KVO declaration which then triggers the Action again and again and again, this is where the loop ...

iPhone: Using static library in an application crashes the device but not the iphone simulator

I have a library I made, and now I want to utilize it in an application. I've believe I've properly linked to the library. Here are all the things I've done: Set the header search path Set other linker flags to "-ObjC" Added the static library xcode project Made sure the lib.a was listed as a framework target Added the library as a dir...

UITabBarController, UINavigationController from another NIB file

Hello guys, I spent several hours trying to load subclassed UINavigationController from another NIB while taping a tabBarItem. Does anyone have any idea, how to do it correctly? The latest test: MainWindow.xib - UITabBarController with 4 tabs, one is named News and is set to "Navigation Controller" While News tab is selected - class id...

Cocoa-Touch: dynamically resizing views

I have a UITableView which occupies the entire screen, besides a navigation bar. The UINavigationItem has a UIBarButtonItem that shows a previously hidden UIPickerView when tapped. I'm trying to resize the UITableView so that it occupies the rest of the screen not used by the now visible UIPickerView. I know the framework already does ...

Fade in/Fade out for MAAttachedWindow

I'm using Matt Gemmell's MAAttachedWindow (http://mattgemmell.com/source) with an NSStatusItem to display a custom view in the menu bar. I'm confused as to how to get it to fade in and fade out. Normally I'd do something like this: [window makeKeyAndOrderFront:self]; [[window animator] setAlphaValue:1.0]; and to fade out: [[window an...