【发布时间】:2011-02-18 23:32:20
【问题描述】:
我遇到了性能问题。
我已经开发了一个应用程序,我没有遇到任何问题 通过导航,该应用程序运行顺畅。 直到我添加了 UITextView,点击时 将视图切换到视图的按钮 我使用了 TextView,大约需要 4 到 5 秒 切换视图。填充 textView 时会发生这种情况 大约 30-40 行文本。
我使用界面生成器添加了 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
注意:我使用 Interface Builder 在 XIB 文件中输入了文本,而不是通过编码,我已将 TextView 的内容更改为我想要的文本。我也做了 TextView 不可编辑。
代码在 Food.m 中 TextView 内容在 Food.xib 中
【问题讨论】:
-
查看填充 UITextView 的代码会很有帮助...
-
您好,感谢您的评论,正如我所说,代码不包含任何与 UITextView 相关的内容。我不知道如何添加代码,但希望您能阅读它,,, [代码] #import "Food.h" #import "MainMenuViewController.h" @implementation Food - (IBAction) mainMenu:(id)sender { MainMenuViewController* mainM = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil] ; [self.navigationController pushViewController:mainM 动画:YES]; } - (void)dealloc { [MainMenuViewController 发布]; [超级释放]; } @end [代码]
-
编辑您的问题,在此处添加代码,突出显示它,然后按
{}按钮。但是在你实际填充文本视图的地方显示代码。 -
谢谢,我编辑了问题
-
你不能解除类的分配。上面的代码中一定有一些缺失/错误。在您的 dealloc 方法中,您通过 [MainMenuViewController release] 释放类;我想您只能释放对象 [super dealloc]; }
标签: iphone performance xcode uitextview