Skip to content

Instantly share code, notes, and snippets.

@chyld
Created July 15, 2012 02:45
Show Gist options
  • Save chyld/3114567 to your computer and use it in GitHub Desktop.
Save chyld/3114567 to your computer and use it in GitHub Desktop.
notes - ios for beginners
Register as an apple developer:
-------------------------------------------------------------------------------------------------
https://developer.apple.com/devcenter/ios/index.action
Evaluate the different types of developer program:
-------------------------------------------------------------------------------------------------
https://developer.apple.com/programs/which-program/
Changing the text of a label:
-------------------------------------------------------------------------------------------------
label.text = @"hello world";
Changing the label color:
-------------------------------------------------------------------------------------------------
label.textColor = [UIColor cyanColor];
Change the label text from a textbox:
-------------------------------------------------------------------------------------------------
label.text = [textbox text];
Change the transparency of a textbox using a slider:
-------------------------------------------------------------------------------------------------
textbox.alpha = [slider value];
Change an image:
-------------------------------------------------------------------------------------------------
switch ([segment selectedSegmentIndex]) {
case 0:
[imageview setImage:[UIImage imageNamed:@"one.jpg"]];
break;
case 1:
[imageview setImage:[UIImage imageNamed:@"two.jpg"]];
break;
case 2:
[imageview setImage:[UIImage imageNamed:@"three.jpg"]];
break;
}
Getting the web control to work:
-------------------------------------------------------------------------------------------------
@interface TMViewController : UIViewController
<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *textbox;
@property (weak, nonatomic) IBOutlet UIWebView *web;
@end
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[web loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:[textbox text]]]];
[textField resignFirstResponder];
return YES;
}
Getting the map control to work:
-------------------------------------------------------------------------------------------------
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface TMViewController : UIViewController
@property (weak, nonatomic) IBOutlet MKMapView *map;
- (IBAction)satellite:(id)sender;
@end
- (IBAction)satellite:(id)sender {
[map setMapType:MKMapTypeSatellite];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment