March 31, 2009
Button_FunViewController.h#import <UIKit/UIKit.h>
@interface Button_FunViewController : UIViewController {
IBOutlet UILabel *statusText;
}
@property (retain, nonatomic) UILabel *statusText;
- (IBAction)buttonPressed:(id)sender;
@endButton_FunViewController.m#import "Button_FunViewController.h"
@implementation Button_FunViewController
@synthesize statusText;
-(IBAction)buttonPressed:(id)sender
{
NSString *title = [sender titleForState:UIControlStateNormal];
NSString *newText = [[NSString alloc] initWithFormat:
@"%@ button pressed.", title];
statusText.text = newText;
[newText release];
}
-(BOOL)shouldAutorotateInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)dealloc {
[statusText release];
[super dealloc];
}
@endAda yang tahu itu bahasa apa dan code di atas ngapain? Kalau ada, berarti sudah ada yang lebih dulu menguasai. And to whoever he/she is: "Master, I beg you to teach me!!. You Kung fu is very good."
More post (about this) to come.