[英]UIWebView “decays” to UIView when added to navigation controller
[英]UIView page flickers (for first time only) when pushing it on navigation controller
我在UIView
頁面中具有以下視圖層次結構:
2個UIButtons
1個ImageView
1個UILabel
1個UITableView
分組樣式-僅包含一個單元格(自定義單元格類型,完全使用沒有任何xib的代碼創建),該單元格包含以下視圖層次結構:
ImageView
2 OHAttributedLabels
[這是它的gitHub頁面]
1個UILabel
使用CGAffineTransform
方法垂直旋轉
我使用以下命令將這個視圖的視圖控制器推到導航控制器上: pushViewController
方法,但是,除了第一次打開應用程序的情況之外,其他一切都正常,當第一次按下該視圖控制器時,視圖立即閃爍一次(帶有黑色屏幕邊緣上的小條),當我導航回應用程序中的其他視圖,然后重新打開該視圖時,不會閃爍。
這種閃爍的原因是什么?
先感謝您。
ps OHAttributedLabel
在應用程序的其他視圖上進行了測試,沒有任何問題。
編輯:以下代碼來自view1.m(在上述問題中正在談論的視圖im):
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIImage *backgroundImage = [UIImage imageNamed: @"bg1.png"];
UIImageView *backGroundImageView = [[[UIImageView alloc] initWithImage: backgroundImage] autorelease];
backGroundImageView.frame = CGRectMake(0,0,320,411);
[self.view addSubview: backGroundImageView];
[self.view sendSubviewToBack: backGroundImageView];
self.gsTableView.layer.cornerRadius = 10; // to make a the corner of the table view rounded
self.gsParagraphs = [NSArray arrayWithObjects:
NSLocalizedString(@"this is a test string this is a test string this is a test string this is a test string this is a test string this is a test string this is a test string this is a test string this is a test string" , @"test string1"),
NSLocalizedString(@"this is another test string this is another test string this is another test string this is another test string this is another test string this is another test string" , @"test string2"),
nil];
}
以下代碼適用於view1.m文件中的cellForRowAtIndexPath方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *MyIdentifier = [NSString stringWithFormat:@"MyIdentifier %i", indexPath.row];
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
cell.imageView.image = [UIImage imageNamed: @"gs_1.jpg"];
cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.cornerRadius = 5.0;
// cell.textLabel.text = [self.gsParagraphs objectAtIndex:0]; //it will become blurry
//note: the attributed label is used to easily apply justified alignment and many other options
NSMutableAttributedString* cellBody1 = [NSMutableAttributedString attributedStringWithString:[self.gsParagraphs objectAtIndex:0]];
[cellBody1 setTextAlignment:UITextAlignmentJustify lineBreakMode: UILineBreakModeWordWrap];
cell.secondTextLabel.attributedText = cellBody1;
NSMutableAttributedString* cellBody2 = [NSMutableAttributedString attributedStringWithString:[self.gsParagraphs objectAtIndex:1]];
[cellBody2 setTextAlignment:UITextAlignmentJustify lineBreakMode: UILineBreakModeWordWrap];
cell.thirdTextLabel.attributedText = cellBody2;
// cell.cellLabelTextYOffset = 10; this is necessary only for the original text label
cell.cellTitle.text = NSLocalizedString(@"Test Title", @"Test Title");
cell.cellTitleLabelWidth = 170;
return cell;
}
沒有適用於viewDidAppear方法的代碼
尚不清楚您為什么懷疑表視圖控制器。 閃爍是否在表格范圍內?
一些嫌疑犯:
如果為視圖控制器和表委托創建了所有委托方法,則按什么順序調用哪些委托方法?
我不知道它是否仍然有效,但是我使用了一個白色的按鈕來代替一個單元格的分組表。 如果您從未計划添加另一個單元格,則幾乎不需要使用整個表。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.