Objective C
NSMutableArray *arr = [NSMutableArray withObjects:@"Durango",@"Bayfield", nil];
[arr addObject:@"Pagosa Springs"]
NSArray *sortedArray = [anArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
Ruby
(main)> arr = ["Durango", "Bayfield"]
=> ["Durango", "Bayfield"]
(main)> arr << "Pagosa Springs"
=> ["Durango", "Bayfield", "Pagosa Springs"]
(main)> arr.sort
=> ["Bayfield", "Durango", "Pagosa Springs"]
(main)> "Hello World".class.ancestors
=> [String, NSMutableString, NSString, Comparable, NSObject, Kernel]
(main)> ["Durango", "Bayfield"].class.ancestors
=> [Array, NSMutableArray, NSArray, Enumerable, NSObject, Kernel]
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Durango Coders"
message:@"Welcome to ObjectiveC"
delegate:nil
cancelButtonTitle:@"Let's Code"
otherButtonTitles: nil];
[alert show];
return YES;
}@end
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@alert = UIAlertView.alloc.initWithTitle("Durango Coders",
message: "Welcome to Ruby Motion",
delegate: nil,
cancelButtonTitle: "Let's Code",
otherButtonTitles: nil)
@alert.show
true
end
end
http://rubymotion-wrappers.com/
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
return self.booksArray.count;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.textLabel.text = [self.booksArray objectAtIndex:indexPath.row];
return cell;
}
Add the following to your rake file
app.identifier = "com.animascodelabs.durango_coders"
app.provisioning_profile = "~/Library/MobileDevice/Provisioning Profiles/<uuid>.mobileprovision"
app.code_sign_certificate = "iPhone Developer: <Your name>"
gem "motion-testflight"