//
#import "YYMenuViewController.h"
@interface YYMenuViewController ()
@property(nonatomic,strong)NSArray *menus;
@end
复制代码
@implementation YYMenuViewController
-(NSArray *)menus
{
if (_menus==nil) {
_menus=@[@"列表1",@"列表2",@"列表3",@"列表4"];
}
return _menus;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.menus.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *ID=@"ID";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:ID];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
}
cell.textLabel.text=self.menus[indexPath.row];
return cell;
}
@end
复制代码
YYViewController.m文件
//
// YYViewController.m
// 01-PopoverController简单介绍
//
// Created by apple on 14-8-17.
// Copyright (c) 2014年 yangyong. All rights reserved.
//
#import "YYViewController.h"
#import "YYMenuViewController.h"
@interface YYViewController ()
@property(nonatomic,strong)UIPopoverController *popover;
@end
@implementation YYViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//1.新建一个内容控制器










