开发者

Performance problem when using UITextView

I am having a performance issue.

I have developed an app, I had no problems with the navigation, the app was working smoothly. Until I added the UITextView, when clicking the button which switches the view to the view where I used the TextView, it takes about 4 to 5 seconds 开发者_开发问答to switch the view. This happens when filling the textView with about 30-40 lines of text.

I added the TextView using the interface builder, whiteout adding any code related to UITextView in Xcode.

Can you please help me solving this issue ??

Thanks.

EDIT: This is the code for the page containing the 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

NOTE: I have entered the text in the XIB file using the Interface Builder, not by coding, where I have changed the content of the TextView to the text I wanted. I also made the TextView not editable.

The code is in Food.m The TextView content is in Food.xib


This looks a bit weird. Anyway, try the following. Instead of putting the text in your UITextView using Interface Builder, do this programmatically. In the view controller responsible for handling your UITextView, simply add the following line in your viewDidLoad method:

myTextView.text = @"your text here";

myTextView is the name you assigned to the outlet variable associated to your UITextView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜