|
最近在iOS设备上编程,为了调试刷了不少机不说了,Objective-C在这些设备上要手动管理内存……麻烦死了会死人的编程也不带这样的啊……
例:- //FirstViewController.h
- #import <UIKit/UIKit.h>
- @interface FirstViewController : UIViewController
- {
- IBOutlet UITextView *text;
- }
- @property (nonatomic,retain) IBOutlet UITextView *text;
- @end
- //FirstViewController.m
- #import "FirstViewController.h"
- #import <QuartzCore/QuartzCore.h>
- @implementation FirstViewController
- @synthesize text;
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- [[text layer] setCornerRadius:12];
- [[text layer] setMasksToBounds:YES];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- }
- - (void)viewDidUnload
- {
- [text release];
- [super viewDidUnload];
- }
- @end
复制代码 |
|