我正在为Xcode 5中的iOS7应用程序开发,但自从升级到iOS 8和Xcode 6后,我遇到了一些问题。
基本上,我使用SWRevealViewController为我的应用程序创建滑动侧边栏。此侧栏有许多行,其中包含标签和图片。它们之前显得很好,但现在看起来如下所示:
http://postimg.org/image/4ddj5n6df/
他们都聚集在一起。我还得到了几个'Missing constraints'错误以及两个'Scrollable Content Size'错误。
可能是因为SWRevealViewController插件没有正确升级才能与iOS 8一起使用吗?还有其他选择吗?
@interface foodforteethSidebarViewController ()
@property (nonatomic, strong) NSArray *menuItems;
@end
@implementation foodforteethSidebarViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.separatorColor = [UIColor colorWithWhite:0.4f alpha:0.2f];
_menuItems = @[@"home", @"title", @"cereals", @"meats", @"snacks", @"dairy", @"drinks", @"desserts", @"fastfoods", @"fruitandveg", @"sauces", @"confectionaries", @"misc"];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.menuItems count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = [self.menuItems objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
return cell;
}
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender
{
// Set the title of navigation bar by using the menu items
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UINavigationController *destViewController = (UINavigationController*)segue.destinationViewController;
destViewController.title = [[_menuItems objectAtIndex:indexPath.row] capitalizedString];
if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {
SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;
swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {
UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
[navController setViewControllers: @[dvc] animated: NO ];
[self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
};
}
}
@end
由于