2011-02-18 47 views
1

我遇到性能問題。使用UITextView時的性能問題

我開發了一個應用程序,我用導航沒有問題 ,該應用程序運行順利。 直到我添加了UITextView,點擊 將視圖切換到該視圖的按鈕 我使用了TextView,它需要大約4到5秒才能切換到視圖 。使用約30-40行文本填充textView 時會發生這種情況。

我添加了使用界面生成器的TextView,whiteout 在Xcode中添加了與UITextView相關的任何代碼。

你能幫我解決這個問題嗎?

謝謝。

編輯:這是包含TextView的頁面代碼

// Food.m 
// Azkar 
// 
// Created by al3madi on 18/02/2011. 
// Copyright 2011 __MyCompanyName__. All rights reserved. 
// 

#import "Food.h" 
#import "MainMenuViewController.h" 


@implementation Food 

- (IBAction) mainMenu:(id)sender { 
    MainMenuViewController* mainM = [[MainMenuViewController 
             alloc] initWithNibName:@"MainMenuViewController" bundle:nil]; 

    [self.navigationController pushViewController:mainM animated:YES]; 
} 


- (void)dealloc { 
    [MainMenuViewController release]; 
    [super dealloc]; 
} 


@end 

注:我,而不是編碼,在那裏我已經改變的內容進入使用界面生成器在XIB文件中的文本將TextView轉換爲我想要的文本。我也使 TextView不可編輯。

的代碼是Food.m TextView的內容是Food.xib

+0

這將是有益的,看看你在哪裏填充的UITextView ... – 2011-02-18 23:36:09

+0

你好,感謝您的評論的代碼,正如我所說,該代碼不包含相關的UITextView任何事情。我不知道如何添加代碼,但我希望你能讀它,,, [代碼]#進口 「Food.h」 #進口 「MainMenuViewController.h」 @implementation食品 - (IBAction爲)MAINMENU:(ID)發送{ \t MainMenuViewController * mainM = [[MainMenuViewController \t \t \t \t \t \t \t \t \t alloc] initWithNibName:@「MainMenuViewController」bundle:nil]; \t \t [self.navigationController pushViewController:mainM animated:YES]; } - (void)dealloc \t [MainMenuViewController release]; \t [super dealloc]; } @end [code] – 3madi 2011-02-19 00:31:19

回答

0

這看起來有點怪異。無論如何,請嘗試以下操作。不要使用Interface Builder將UITextView中的文本編程,而是以編程方式執行此操作。在負責處理您UITextView視圖控制器,只需在您的viewDidLoad方法如下一行:

myTextView.text = @"your text here"; 

myTextView是您分配給關聯到你的UITextView出口變量名稱。