Category Archives: iOS

Push Multiple Views onto Nav Stack

NSMutableArray *controllers = [self.navigationController.viewControllers mutableCopy];
[controllers addObject:secondVc];
[controllers addObject:thirdVC];
[self.navigationController setViewControllers:controllers animated:YES];

Courtesy of Stack Overflow:

http://stackoverflow.com/questions/21857222/how-to-push-two-view-controllers-but-animate-transition-only-for-the-second-one

 

INavigationController *a = (UINavigationController *)self.tabBarController.selectedViewController;
Second11ViewController *view11 = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"second1"];
Second22ViewController *view22 = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"second2"];
view11.hidesBottomBarWhenPushed = YES;
view22.hidesBottomBarWhenPushed = YES;

 

Set a background colour of a uitableview

    
    self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tablebackground.png"]];
    self.tableView.backgroundColor = [UIColor clearColor];

 

Back Button Text

    self.navigationItem.backBarButtonItem =
    [[UIBarButtonItem alloc] initWithTitle:@"Back"
                                     style:UIBarButtonItemStylePlain
                                    target:nil
                                    action:nil];

 

Background image in UITableViewCell

    UIImage *background = [UIImage imageNamed:tableViewCellBackgroundImage];
    UIImageView *cellBackgroundView = [[UIImageView alloc] initWithImage:background];
    cellBackgroundView.image = background;
    tableCell.backgroundView = cellBackgroundView;

 

Remove Cell Separator Style from UITableView

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

 

Configure keys and ssl certs for apple Push Notification

Great guide for configuring push notification:

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

DNS Cache Flush Mac OS X


dscacheutil -flushcache

Xcode 4 Source Control Woes

I spent an age trying to work out why i couldn’t check out my code from a SVN REPO.

So turns out Xcode will not allow you to download from a SVN source that uses a untrusted SSL certificate.

You would get an error similar to: The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!

So how to work around this?

Open up a terminal window, and begin a manual attempt at downloading the SVN repo with something like this..


svn co https://........

you will then be prompted to reject, accept or permanently trust this certificate..

Hope this helps some poor soul..

IndexPath Row from sub-function

Ever wondered how you could generate the IndexPath row from a Function not related to tableview?

UITableViewCell *clickedCell = (UITableViewCell *)[[sender superview] superview];
NSIndexPath *clickedButtonPath = [_tableView indexPathForCell:clickedCell];
int row = [clickedButtonPath row];
NSLog(@"%i",row);

Hide UI Keyboard, back to basics

in ViewDidLoad set the UITextfield delegate to self, and assign to the firstresponder like this

- (void)viewDidLoad {
[textfield setDelegate:self];
[textfield becomeFirstResponder];
}


- (BOOL)textFieldShouldReturn:(UITextField *)textfield
{
[textfield resignFirstResponder];

}