出於某種原因,我無法在代碼中更改或添加我的UITextView中的文本。Obejct-C/Xcode無法在UITextView中添加/更改文本
我做了Outlet並連接(全部在IB) - 沒有任何反應。 甚至試圖添加-setNeedsDisplay 我是否需要設置一些屬性? - 這我逼我堅果....
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController <UITextViewDelegate> {
UITextView *textInfoView;
}
@property (nonatomic, retain) IBOutlet UITextView *textInfoView;
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
textInfoView.text = @"Test";
}
-(void)viewDidAppear:(BOOL)animated{
textInfoView.text = @"Test";
textInfoView.text = [textInfoView.text stringByAppendingString:@"Line2"];
[textInfoView setNeedsDisplay];
您運行的是哪個版本的Xcode?我有版本4.4,並在大約一週前更新... – 2012-08-04 08:06:22
我也有4.4版本。 – aleroot 2012-08-04 09:00:40