私はFirstViewとSecondという名前の2つのUIViewcontrollerクラスを持っています... firstviewボタンをクリックすると、secondviewに1つの文字列を渡し、その文字列をsecondview uitextviewに表示します...しかし、私は、コードを掲載UITextViewアップデート
のTextView ... ....私はここに
をしないのです何
//first.h
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
IBOutlet UIButton *btnView;
}
@property(nonatomic,retain) UIButton *btnView;
-(IBAction)UpdateSecondView:(id)sender;
@end
//first.m
#import "FirstViewController.h"
#import "SecondViewController.h"
#import "testtabbarAppDelegate.h"
@implementation FirstViewController
@synthesize btnView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Initialization code
}
return self;
}
/*
Implement loadView if you want to create a view hierarchy programmatically
- (void)loadView {
}
*/
- (void)viewDidLoad {
}
-(IBAction)UpdateSecondView:(id)sender
{
SecondViewController *object=[[SecondViewController alloc]initWithNibName:@"SecondView" bundle:nil];
[object UpdateText:@"Testing"];
[object release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[btnView release];
[super dealloc];
}
@end
//second.h
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController {
IBOutlet UITextView *textView;
NSString *globalString;
}
@property(nonatomic,copy) NSString *globalString;
@property(nonatomic,retain) UITextView *textView;
-(void)UpdateText:(NSString *)string;
@end
//second.m
//
// SecondViewController.m
// testtabbar
//
// Created by mac user on 6/9/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "SecondViewController.h"
@implementation SecondViewController
@synthesize textView;
@synthesize globalString;
//NSString *[email protected]"";
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Initialization code
}
return self;
}
/*
Implement loadView if you want to create a view hierarchy programmatically
- (void)loadView {
}
*/
- (void)viewDidLoad
{
}
-(void)UpdateText:(NSString *)string
{
textView.text=string;
}
- (void)viewWillAppear:(BOOL)animated
{
}
- (BOOL)textViewShouldReturn:(UITextView *)theTextView {
// When the user presses return, take focus away from the text field so that the keyboard is dismissed.
if (theTextView == textView) {
[textView resignFirstResponder];
}
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[globalString release];
[textView release];
[super dealloc];
}
@end
は誰も私を助けることができますか?
事前のおかげで...