CocoaPods project setup
Create a Podfile
at the root of your project
platform :ios, '5.0'
pod 'AFNetworking'
pod 'OHAttributedLabel'
function createNewNutshellLead( $api ) { | |
$ns_contact_id = $this->setNutshellContactAndReturnID( $api ); | |
$products = array(); | |
$quote_price_ex_vat = ( $this->price + $this->getAdditionalProductsTotalPrice() ); | |
$quote_product = array( | |
'qty'=>1, |
Create a Podfile
at the root of your project
platform :ios, '5.0'
pod 'AFNetworking'
pod 'OHAttributedLabel'
// unpredictable backing type for this enum | |
typedef enum { | |
CDZTypePhone, | |
CDZTypeEmail | |
} CDZType; | |
// vs. | |
enum { | |
CDZTypePhone, |
// ... | |
#pragma mark UITableViewDelegate methods | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
NSMutableArray *attributes = [NSMutableArray array]; | |
id labelAttributes = @{ | |
UITableViewCellNLHeightAttributeText: [self textLabelTextAtIndexPath:indexPath], |
You have some kind of custom UIView
which implements some awesome drawing in -[UIView drawRect:]
. In order to have UIKit draw it for you, you send the -[UIView setNeedsDisplay]
to the view object to queue it up for drawing.
*------------* *------------*
| | | |
CGRectDivide is handy for slicing up a rectangle.
Example of getting a slice and the remaining area of a rectange.
CGRect rect = CGRectMake(0, 0, 240, 150);
CGRect remainder, slice;
CGRectDivide(rect, &slice, &remainder, 120, CGRectMinYEdge);
The NSKeyValueObserving
addition to NSObject
adds an observe message that takes an identifying context pointer – don't use NULL
in its place.
Your superclass may observe the same key path for the same object. You need to pass along its observations, and only take actions on yours. The context pointer distinguishes which observations are yours.
static void *kContext = &kContext;
To conform to Apple's human-interface guidelines, you need to implement the following tasks when subclassing UIViewController
and including a UITableView
in your hierarchy (hence recreating UITableViewController
):
In -[UIViewController viewWillAppear:]
, clear the selected row (if any) by sending the -[UITableView deselectRowAtIndexPath:animated:]
message.
In -[UIViewController viewDidAppear:]
, send the -[UITableView flashScrollIndicators]
message.
#import <SenTestingKit/SenTestingKit.h> | |
#import "OCMock.h" | |
#import "SenTestCase+MethodSwizzling.h" | |
#import <objc/runtime.h> | |
#import "NLWelcomeViewController.h" | |
#import "NLWelcomeFlowGoogleViewController.h" | |
#pragma mark Setup |
public void testJSONObjectEquality() throws Exception { | |
final JSONObject json1 = new JSONObject("{ \"foo\" : 1 }"); | |
final JSONObject json2 = new JSONObject("{ \"foo\" : 1 }"); | |
assertEquals(json1, json2); | |
} | |
// junit.framework.AssertionFailedError: expected:<{"foo":1}> but was:<{"foo":1}> | |