Results tagged “iphone” from muse

The possibleTitles property of UIBarButtonItem is pretty useful if you need to change the title and also animate the changes. I was trying to animate both the back button and the title of the right barbutton at the same time, but the back button wouldn't disappear properly (i.e. not animated) until I set the possibleTitles of the right barbutton.

First create the button. Do this in viewDidLoad.

self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStyleBordered target:self action:@selector(toggleEditing)] autorelease];
self.navigationItem.rightBarButtonItem.possibleTitles = [NSSet setWithObjects:@"Edit", @"Done", nil];

To change the title just set the title property. Very easy. Both changes will be animated.

- (void)toggleEditing {
	if (!self.editing) {
		self.navigationItem.rightBarButtonItem.title = @"Done";
		[self.navigationItem setHidesBackButton:YES animated:YES];
	} else {
		self.navigationItem.rightBarButtonItem.title = @"Edit";
		[self.navigationItem setHidesBackButton:NO animated:YES];
	}
}

This works in OS 3.0.

2G iPhone updating to iPhone OS 3.0

|

It's confirmed that if you have a 2G iPhone that is unlocked with BootNeuter (running firmware 2.2.1), you can safely update to OS 3.0 using iTunes (yes just press that Update button).

For detailed and step-by-step instructions see here

Clear Crash Logs of iPhone

|

This afternoon I noticed, for the first time, that I have 757 crash logs on the iPhone I use for development, great. Here is a very simple way to delete all of them in 2 steps:

  • Disconnect the iPhone from your computer. Quit XCode, too.
  • The path to crash logs for iPhone (and iPod Touch) is: /Users/user/Library/Logs/CrashReporter/MobileDevice. To clear all crash logs, simply deleted everything inside that folder.

iPhone Color Profile

|

For a quick and easy way to preview what the colors would look like on iPhone in Photoshop, set the color profile to Apple RGB.

This method requires: jailbreaked iPhone 2.x, Cydia, Term-vt100, OpenSSH

Install MobileInstallation Patch from Cydia via “http://www.iphone.org.hk/apt/”, the patch is under section “Tweaks”. If you currently have the hackulo.us MobileInstallation, you ALSO need to install the patch. Don’t worry, you can install appulous apps with this patch.

  • In XCode, go to Project > Edit Project Settings.
  • Set Base SDK to "Device - iPhone OS 2.0"
  • Under Code Signing Identity, set Any iPhone OS Device to "Don't Code Sign"
  • Delete the value of Code Signing Resource Rules Path
  • Delete all previous build files.
  • Go to Project > Set Active SDK > Device - iPhone OS 2.0
  • Go to Project > Set Active Build Configuration > Release
  • Build. NOT Build and Go.
  • Copy MyApp.app to iPhone under /Applications using ssh or whatever method you prefer.

Now open Terminal on iPhone and execute the following code

su -
chmod +x MyApp.app
ldid -S MyApp.app/MyApp
killall SpringBoard //restart the SpringBoard

Run MyApp by touching the icon on SpringBoard.

Update: With the MobileInstallation Patch mentioned above, iPhone 2.2 seems unable to install/upgrade app by itself, you have to use iTunes (8.x) to uninstall an app first, then install/upgrade it.