objective-c

SubView doesn't want to fit into specified frame.

The the problem arises when i dynamically load subview from nib and add it to the current main view during viewDidLoad. UIView *someView = // load from nib someView.frame = CGRectMake(.0, .0, kFormSheetWidth /* = 540.0 */, kFormSheetHeight) /* = 576.0 */; [self.view addSubview:some...

Sqlite doesn't seem to like my delete statement

I've got the following iphone code, which seems to be failing: sqlite3_stmt *dbps; NSString *sql = @"delete from days where day=?1;insert into days(disabled,recipe_id,day) values(?2,?3,?1)"; int rc = sqlite3_prepare_v2(db, sql.UTF8String, -1, &dbps, NULL); ... The 'rc' return code is 1, meaning SQLITE_ERROR (SQL error or missing datab...

leak problem on NSUserDefaults and NSMutableArray

I have a leak in the following code: - (void)viewDidAppear:(BOOL)animated { //If Home-Theme if (themeIndex == 0) { NSUserDefaults *pref = [NSUserDefaults standardUserDefaults]; NSMutableArray *thisArray = [[NSMutableArray alloc] init]; thisArray = [[pref objectForKey:@"Themes"] mutableCopy]; [thisArra...

Admob for iPhone/iPad

Hello guys! Can you explain me please in short how to start with admob? I registered, but can't find the download link for the sdk. Any good tutorials? Thank you for your help. ...

iPad MPMoviePlayer hiccups

I'm working on an iPad app, it has a few videos within views using the MPMediaPlayer framework. Videos are working nice but on viewLoad there is a flashing of the video area when it loads the video. It shows black for a split second then starts playing. I was thinking of using an NSTimer on viewDidLoad to unhide the hidden video view, ...

iphone : in-app purchase bug on OS 4.0 processing one transaction two times ...

Hi, I am having a strange issue on OS 4.0. i am doing in-app purchase for a consumable product. i start a transaction. my transaction is complete. i provide the content successfully. and transaction is removed from queue. then i exit application. and wait for 1 or 2 minute. and run application again. when i run application again. an...

Best online source for learning C

Hi Im an experienced actionscript developer, and relatively new to Objective C. I decided a good investment of my time would be to master the C language (not C# or C++). Can anyone recommend the 'best' online tutorials for learning C? ...

Passing a pointer to an object onto a child application.

So basically, I have two applications. Application 1 launches Application 2 but it remains in memory. When Application 2 is started it needs to be given a pointer to a CALayer object which is stored in the first application. The object represented by the pointer needs to be accessible by both applications. I am using Objective-C. I wou...

toggle UIButton-state when pressing, like a switch

-(void)setState:(id)sender { UIButton* button = (UIButton*)sender; BOOL buttonBool = ([button state]==selected : YES ? NO); [sender setSelected:buttonBool++]; } this is my idea, but i cant figure out the actual state of the button calling the funktion. any button, that calls this funktion, should be toggled between default...

MPMoviePlayerViewController HTTP Authentication Header

I using the following basic commands to view a movie stored on a server in the movie player: MPMoviePlayerViewController *mMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:getMovieURLRequest.URL]; [self presentModalViewController:mMoviePlayer animated:YES]; The problem is, I am getting a 401 authentication error w...

How to refresh UITableView after app comes becomes active again?

I would like my UITableView to reloadData once my app is active again, after a user exits the application. I know I need to implement (in my app delegate): - (void)applicationDidBecomeActive:(UIApplication *)application but im not sure how to reference the current UITableView? UPDATE: My UITableView is a separate controller. It is a...

Changing the navigationbar color on the Edit screen of the More section

I am able to change the navbar color of the More navigationcontroller via: stTabBarController.moreNavigationController.navigationBar.tintColor = [UIColor colorWithRed:(102.0/255.0) green:(20.0/255.0) blue:(11.0/255.0) alpha:1]; but when I click the Edit button, the Configure screen appears and the navbar color is the default blue. How...

How to call a method that's declared in a ViewController from the AppDelegate

Novice question. I'm building an app and I want to call a method that I've declared in a ViewController - from the AppDelegate (on applicationDidBecomeActive). So basically, In TestAppDelegate.m I have... - (void)applicationDidBecomeActive:(UIApplication *)application { // I want to call a method called "dothisthing" that I'v...

Is it okay to subclass a view controller?

I'm a relative Objective-C noob, so please bear with me. The Apple documentation states that it is not a good idea to have two view controllers controlling a single view. I am building a game which takes place within a single view. I want to create objects that can add themselves to the main view (as sub-views). Is it okay to create ...

Changing the position of the DragRefreshView in the three20 library

Hi I am using the three20 library for an iPhone project. As part of it I am using a pull to refresh (like fb and twitter) on a tableview. It works great, however it would be better if it was at the bottom of the tableview. I cant see any obvious configuration settings to do this (basically no API docs), so I have dug around and it loo...

How tro retrieve the iPhone's locale setting

Hello, I have googled for it but I am a bit surprised that I couldn't find it. I just want to access what locale the device has configured. I tried to find how to list all system propreties (in case I could find the locale there) but couldn't even find how to do that. I know(/think) I have retrieved the system properties before, but I ...

pulling data from a plist

I'm trying to pull some data from plist file and display it in a text field (from a UIButton click). the code below pulls the address of the plist and not the data. any help is greatly appreciated. thanks -(IBAction) buttonPress { NSString *path = [[NSBundle mainBundle] pathForResource:@"messages" ofType:@"plist"]; NSMutableArr...

[[[NSFetchedResultsController sections] objectAtIndex:0] numberOfObjects] > fetchLimit

I am currently having an issue where my UITableViewController/UITableView which uses an NSFetchedResultsController displays about 86 items when the fetchLimit on the fetchRequest for the FRC is 4. I know that 86 items satisfy the fetch itself, and I know that the reason that they appear is because the didChangeObject: atIndexPath... get...

Sorting an NSArray by an NSDictionary value

I'm trying to sort an array that would look something like this: (please ignore the fact these people are well past any living age! I just needed large numbers) NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"sam",@"name",@"28.00",@"age",nil]; NSDictionary *person2 = [NSDictionary dictionaryWithObjectsAndKeys:@"cody...

Program overflows call stack by sheer force of will

Here's the call stack from a user's crash report: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 com.growl.GrowlSafari 0x179d383c writeWithFormat + 25 1 com.growl.GrowlSafari 0x179d388e writeWithFormat + 107 2 com.growl.GrowlSafari 0x179d388e writeWithFormat + 107 3 com.growl.GrowlSafari...