This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)apiRequestDone:(ASIHTTPRequest *)request | |
{ | |
(...) | |
[NSJSONSerialization JSONObjectWithData:[request responseData] options: NSJSONReadingMutableContainers error:&error] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(void)navigationController:(UINavigationController *)navigationController PopNumberOfViews:(NSInteger)numberOfViews | |
{ | |
NSInteger count = [navigationController.viewControllers count]; | |
UIViewController *vc = [navigationController.viewControllers objectAtIndex:(count - (1 + numberOfViews))]; | |
[navigationController popToViewController:vc animated:YES]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UINavigationBar *navBar = [[self navigationController] navigationBar]; | |
//If we want a custom logo: | |
UIImage *backgroundImage = [UIImage imageNamed:@"background_im"]; | |
[navBar setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault]; | |
self.navigationItem.titleView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_img"]] autorelease]; | |
self.navigationController.navigationBar.barStyle = UIBarStyleBlack; | |
self.navigationController.navigationItem.backBarButtonItem.tintColor = [UIColor redColor]; | |
self.navigationController.navigationBar.tintColor = [UIColor redColor]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIColor+IntegerRGB.m | |
// Shell mPayment | |
// | |
// Created by Jose Luis Campaña on 8/21/12. | |
// | |
// | |
#import "UIColor+IntegerRGB.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIColor+IntegerRGB.h | |
// Shell mPayment | |
// | |
// Created by Jose Luis Campaña on 8/21/12. | |
// | |
// | |
#import <UIKit/UIKit.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell*) tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath | |
{ | |
static NSString* customCellIdentifier = @"CustomCellIdentifier"; | |
CustomCell* cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:customCellIdentifier]; | |
if (cell == nil)// tableview not associated (registered) with nib file. | |
{ | |
UINib* customCellNib = [UINib nibWithNibName:@"CustomCell" bundle:nil]; // Register this nib file with cell identifier. | |
[tableView registerNib: customCellNib forCellReuseIdentifier:customCellIdentifier]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Formula to find the width of UILabel with the text length | |
#define MY_LABEL_FONT_SIZE 18 | |
#define MY_LABEL_TEXT_WIDTH_MULTIPLIER(MY_LABEL_FONT_SIZE/2 + 1) | |
For example if we have a String of length 8 characters then we can find the width of the UILabel which can fit the text as : | |
8* MY_LABEL_TEXT_WIDTH_MULTIPLIER | |
and setting the Font Size of the UILabel text as MY_LABEL_FONT_SIZE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline double radians (double degrees) {return degrees * M_PI/180;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIImage-Extensions.m | |
// | |
// Created by Hardy Macia on 7/1/09. | |
// Copyright 2009 Catamount Software. All rights reserved. | |
// | |
#import "UIImage-Extensions.h" | |
CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIImage-Extensions.h | |
// | |
// Created by Hardy Macia on 7/1/09. | |
// Copyright 2009 Catamount Software. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface UIImage (CS_Extensions) | |
- (UIImage *)imageAtRect:(CGRect)rect; |