解决方案 »
- 怎样在ios上获取wifi的相关信息?
- 能用Web View实现字体的缩放吗?
- 新手高分求助iphone开发注册问题~见笑了~
- 如何让虚拟键盘横屏显示!
- 有关水的游戏思路求助
- IOS6.1模拟器长按软件删除跳出xcode提示出错 signal sigkill 是什么情况啊?求大神告知!
- 请问如何知道NSMutableAttributedString 的高度
- 用.net开发的网页程序,使用listbox控件,在ios safari下显示的却是另外的样子
- iOS中关于使用UIWebView显示网页奇葩一幕
- ios开发----谁有没有做过用户登录过期,重新登录,跳到退出前的那个界面
- mac应用程序开发问题,怎么在自己代码里控制另一个app应用。
- 新人,求教OC语法相关
#import "Student.h"@class StudentDetailsViewController;@protocol StudentDetailsViewControllerDelegate <NSObject>- (void)studentDetailsViewControllerDidFinish:(StudentDetailsViewController *)sender;@end@interface StudentDetailsViewController : UIViewController<UITextFieldDelegate>@property (strong, nonatomic) Student *currentStudent;@property (weak, nonatomic) IBOutlet UITextField *classNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *nameTextField;
@property (weak, nonatomic) IBOutlet UITextField *numberTextField;@property (weak, nonatomic) id<StudentDetailsViewControllerDelegate>delegate;- (IBAction)revert:(id)sender;
@end这是.m文件里的:#import "StudentDetailsViewController.h"@interface StudentDetailsViewController ()@end@implementation StudentDetailsViewController- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)revert:(id)sender {
[self populateViewWithStudent:self.currentStudent];
}
// Populate the data
- (void)populateViewWithStudent:(Student *)student
{
self.currentStudent = student;
self.classNameTextField.text = student.className;
self.nameTextField.text = student.name;
self.numberTextField.text = student.number;
}- (void)viewWillAppear:(BOOL)animated
{
[self populateViewWithStudent:self.currentStudent];
}- (void)viewWillDisappear:(BOOL)animated
{
[self.view.window endEditing:YES];
self.currentStudent.name = self.nameTextField.text;
self.currentStudent.className = self.classNameTextField.text;
self.currentStudent.number = self.numberTextField.text;
[self.delegate studentDetailsViewControllerDidFinish:self];
}
ViewController *destVC = (ViewController *)segue.destinationViewController;
destVC.currentStudent = chosenStudent;
}
@property (nonatomic, assign) id <StudentDetailsViewControllerDelegate> delegate;
ARC环境下,strong = retain