Skip to content

Instantly share code, notes, and snippets.

#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
/* ViewController.m */
-(IBAction)searchGoogleTapped:(id)sender {
SearchViewController *wv = [[SearchViewController alloc] init];
[wv searchGoogle:searchTerm];
[self presentViewController:wv animated:YES completion:nil];
}
/* SearchViewController.m */
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"showStoryViewController"]) {
[segue.destinationViewController setDelegate:self];
}
}
- (void)storyViewControllerDidPressDoneWithText:(NSString *)text note:(Note *)note
{
self.note = [NSString stringWithString:note];
#import <UIKit/UIKit.h>
#import "NewListViewController.h"
@interface ListTableViewController : UITableViewController <NewListDelegate>
@property (nonatomic, retain) NSMutableArray *lists;
- (IBAction)presentNewListViewController:(id)sender;
@end
#import <UIKit/UIKit.h>
#import "NewListViewController.h"
@interface ListTableViewController : UITableViewController <NewListDelegate>
@property (nonatomic, retain) NSMutableArray *lists;
- (IBAction)presentNewListViewController:(id)sender;
@end
#import <UIKit/UIKit.h>
#import "NewBookingViewController.h"
@interface BookingMainViewController : UITableViewController
<NewBookingDelegate>
@property (nonatomic, assign) NSMutableArray *bookings;
- (IBAction)addNewBooking;
@end
@jonlambert
jonlambert / gist:4578008
Created January 20, 2013 11:28
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
BookingPageViewController *bookingPageViewController = [[BookingPageViewController alloc] init];
bookingPageViewController.booking = [self.bookings objectAtIndex:indexPath.row];
[self.navigationController pushViewController:bookingPageViewController animated:YES];
}

2D Arrays

Tables can be represented as 2D arrays.

$table = array(
  "Row 1" => array("Column 1 - row 1", "Column 2 - row 1", "Column 3 - row 1"),
  "Row 2" => array("Column 1 - row 2", "Column 2 - row 2", "Column 3 - row 2")
);
SELECT node.title,
field_data_gsl_addressfield.gsl_addressfield_country,
field_data_gsl_addressfield.gsl_addressfield_postal_code,
field_data_gsl_props_phone.gsl_props_phone_value,
field_data_gsl_geofield.gsl_geofield_lat,
field_data_gsl_geofield.gsl_geofield_lon
FROM node
WHERE field_data_gsl_addressfield.gsl_addressfield_country = "GB"
INNER JOIN field_data_gsl_addressfield ON field_data_gsl_addressfield.entity_id = node.nid
INNER JOIN field_data_gsl_props_phone ON field_data_gsl_props_phone.entity_id = node.nid