How to set the title in a Navigation Bar
Here’s what the title in a UINavigationBar looks like: You set it like this: self.navigationItem.title = @”My Title”;
Here’s what the title in a UINavigationBar looks like: You set it like this: self.navigationItem.title = @”My Title”;
This will bring up the UIActionSheet on iPhone devices from the bottom of the screen: // trigger a UIActionSheet UIActionSheet *myActionSheet; myActionSheet = [[UIActionSheet alloc]initWithTitle:@”My Title” delegate:self cancelButtonTitle:@”Cancel” destructiveButtonTitle:@”Cancel in Red” otherButtonTitles:@”Open in Safari”, nil]; myActionSheet.actionSheetStyle = UIActionSheetStyleAutomatic; [myActionSheet showInView:self.view]; You can add more buttons if you like by comma separating them. If you don’t […]
By default, when you touch a cell in a UITableView, it lights up bright blue. You can use this property to change the cell’s selection style in the cellForRowAtIndexPath method: cell.selectionStyle = UITableViewCellSelectionStyleGray; Possible values are UITableViewCellSelectionStyleGray UITableViewCellSelectionStyleBlue (the default) UITableViewCellSelectionStyleNone Alternatively you can select the cell in Interface Builder and pick these values from […]
Instead of loading a URL into a UIWebView we can also launch Safari to display it: UIApplication *mySafari = [UIApplication sharedApplication]; NSURL *myURL = [[NSURL alloc]initWithString:@”http://www.mydomain.com”; [mySafari openURL:myURL]; The method returns a BOOL value which will feed back if this operation was a success or not: if (![mySafari openURL:myURL]) { // opening didn’t work } […]
To read out the URL of what a Web View is currently displaying we can use this method: NSURL *myURL = [[NSURL alloc]init]; myURL = self.myWebView.request.URL.absoluteURL; Or, if we’d like to retrieve this as a string: myString = self.myWebView.request.URL.absoluteString;
Storing small bits of info in iCloud is very similar to using the local NSUserDefaults device storage. The only difference is that your App ID needs to be enabled for iCloud in iTunes Connect and that you need to enable it in your project: Here’s how you save data to iCloud (from a text label): […]
Observers are a great way to call a method in a class when you don’t have direct access to it. If you can’t figure out what relationship this class has to the one you want to call the method from, Observers are a very easy way to send a message and trigger an action. In […]
I had always assumed that to restart Plesk, all that was necessary was the following command: service psa restart However, since Plesk is in charge of a multitude of services that’s not enough. Instead, we should be using service psa stopall service psa start Or if the service command isn’t working for you, you can … Read more