Я пытаюсь представить контроллер представления из другого контроллера представления, и он работает, но представленный контроллер имеет черный фон, и я хочу, чтобы он был четким.
- (void)showMenu
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
MenuTableViewController *menu = [[MenuTableViewController alloc]initWithNibName:@"MenuTableViewController" bundle:nil];
menu.view.backgroundColor = [UIColor clearColor];
menu.modalPresentationStyle = UIModalPresentationCurrentContext;
blurredView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
[blurredView setBarStyle:UIBarStyleBlack];
[self.view addSubview:blurredView];
[self presentViewController:menu animated:YES completion:nil];
}
MenuTableViewController.h
import <UIKit/UIKit.h>
@interface MenuTableViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@end
MenuTableViewController.m
@interface MenuTableViewController ()
@end
@implementation MenuTableViewController
{
NSMutableArray *menuItems;
NSMutableArray *insuranceItems;
}
- (void)viewDidLoad
{
[super viewDidLoad];
menuItems = [NSMutableArray arrayWithObjects:@"Action Alerts", @"Ag News", @"Market Updates", @"Tours & Conferences", @"KFB Magazine", @"Member Benefits", @"Ag Facts", @"Roadside Farm Markets", @"Weather", @"Annual Meeting", @"Media", nil];
insuranceItems = [NSMutableArray arrayWithObjects:@"My KYFB", nil];
self.view.backgroundColor = [UIColor clearColor];
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = NO;
self.automaticallyAdjustsScrollViewInsets = NO;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (section == 0)
{
return @"Federation";
}
else
{
return @"Insurance";
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0)
{
return menuItems.count;
}
else
{
return insuranceItems.count;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *mbTableIdentifier = @"SimpleTableItem";
// UIColor *kfbBlue = [UIColor colorWithRed:8.0/255.0f green:77.0/255.0f blue:139.0/255.0f alpha:1];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:mbTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:mbTableIdentifier];
cell.textLabel.font=[UIFont systemFontOfSize:16.0];
}
cell.textLabel.font = [UIFont fontWithName:@"FranklinGothicStd-ExtraCond" size:24.0];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.textColor = [UIColor whiteColor];
cell.backgroundColor = [UIColor clearColor];
if (indexPath.section == 0)
{
cell.textLabel.text = [menuItems objectAtIndex:indexPath.row];
}
else
{
cell.textLabel.text = [insuranceItems objectAtIndex:indexPath.row];
}
return cell;
}
UIModalPresentationCustom
и не выполняете собственный переход) предполагается, что презентация будет полноэкранной, а контроллер представления представления удален из иерархии. - person Mike Pollard   schedule 02.07.2014