" * -[PlayingCell layoutSublayersOfLayer:] 中的断言失败,/SourceCache/UIKit_Sim/UIKit-2372/UIView.m:5776 2013-11-01 18:44:12.526 SnapTrack[216:c07] *由于未捕获的异常而终止应用程序' NSInternalInconsistencyException', 原因:'执行-layoutSubviews 后仍需要自动布局。PlayingCell 的-layoutSubviews 实现需要调用super。'"
我正在尝试在 iOS6 模拟器中运行我的应用程序(我为 iOS7 设计的)。我的项目包含一个 TabBarController。在 tabbarcontroller 的第一个视图控制器中,我有一个包含自定义 UITableViewCell 的表视图。他们加载没有问题。但是,当我切换到另一个选项卡时,我有另一个表格视图,也有自定义单元格,我收到上面发布的错误。viewController 的设置几乎相同(两者都有自动布局的子视图)。有没有人看到这个异常/知道如何解决它?
谢谢!
编辑:PlayingCell 的代码。
#import <UIKit/UIKit.h>
@interface PlayingCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *lblTrackNum;
@property (strong, nonatomic) IBOutlet UIImageView *albumArt;
@property (strong, nonatomic) IBOutlet UILabel *lblSongTitle;
@property (strong, nonatomic) IBOutlet UILabel *lblAlbumTitle;
@property (strong, nonatomic) IBOutlet UILabel *lblArtist;
@property (strong, nonatomic) IBOutlet UIImageView *imgPlay;
@property (strong,nonatomic) NSMutableDictionary *songInfo;
- (IBAction)downloadBtnPressed:(id)sender;
@end
#import "PlayingCell.h"
@implementation PlayingCell
@synthesize songInfo;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (IBAction)downloadBtnPressed:(id)sender
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[songInfo objectForKey:@"trackViewUrl"]]];
NSLog(@"%@",[songInfo objectForKey:@"trackViewUrl"]);
}
-(void)layoutSubviews
{
[super layoutSubviews];
}