基于iOS的电子菜单设计与实现--毕业论文 - 图文(8)

2019-03-10 20:08

河北地质大学本科生毕业设计

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return_groupRecordArr.count; }

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

HistoryOrderCell * cell = [tableView

dequeueReusableCellWithIdentifier:@\forIndexPath:indexPath];

group_record * gRecord = [_groupRecordArrobjectAtIndex:indexPath.row]; cell.dateLab.text = gRecord.gRecord_date; cell.timeLab.text = gRecord.gRecord_time; cell.roomLab.text = gRecord.gRecord_room; cell.searchBtn.tag = indexPath.row+1;

[cell.searchBtnaddTarget:selfaction:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; cell.deleteBtn.tag = indexPath.row+1;

[cell.deleteBtnaddTarget:selfaction:@selector(deleteBtnClick:) forControlEvents:UIControlEventTouchUpInside]; return cell; }

#pragma mark - 点击查询显示该条历史记录的详细信息 -(void)showDetails:(UIButton *)sender {

DetailHistoryViewController * detailHistoryVC = [[DetailHistoryViewControlleralloc]init]; detailHistoryVC.selectRow = sender.tag;

[selfpresentViewController:detailHistoryVC animated:YEScompletion:nil]; }

#pragma mark - 点击删除按钮删除该条记录 - (void)deleteBtnClick:(UIButton *)btn {

ALERTVIEWWITHTAG(@\确定要删除该条记录么?\, btn.tag); }

#pragma mark - 关闭按钮

- (IBAction)closeBtnClick:(id)sender {

[selfdismissViewControllerAnimated:YEScompletion:nil]; }

#pragma mark - 清空按钮

- (IBAction)moveAllDateClick:(id)sender {

ALERTVIEWWITHTAG(@\确定要清空所有历史记录么?\, 1000); }

33

河北地质大学本科生毕业设计

#pragma mark - UIAlertViewDelegate

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

if (buttonIndex == 1) {

if (alertView.tag == 1000) {

[DataBaseTooldeleteGroup_RecordTable]; [DataBaseTooldeleteRecordTable];

NSUserDefaults * defaults = [NSUserDefaultsstandardUserDefaults]; [defaults setInteger:0forKey:@\]; } else

{

group_record * gRecord = [_groupRecordArrobjectAtIndex:alertView.tag-1];

[DataBaseTooldeleteGroup_RecordTableWithgRecordTime:gRecord.gRecord_time]; [DataBaseTooldeleteRecordTableWithNum:alertView.tag]; }

_groupRecordArr = [DataBaseToolsearchGroup_RecordTable]; [_groupRecordArrretain];

[self.historyOrderTableViewreloadData]; } }

附录G:

- (void)viewDidLoad {

[superviewDidLoad];

_historyOrderArr = [DataBaseToolsearchRecordTableWithNum:self.selectRow]; [_historyOrderArrretain]; [selfresetPriceLab];

[self.tableViewregisterNib:[UINibnibWithNibName:@\bundle:nil] forCellReuseIdentifier:@\]; }

#pragma mark - 表的协议方法

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return_historyOrderArr.count; }

34

河北地质大学本科生毕业设计

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

CustomCell * cell = [tableView

dequeueReusableCellWithIdentifier:@\forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone;

Record * record = [_historyOrderArrobjectAtIndex:indexPath.row];

cell.idLab.text = [NSStringstringWithFormat:@\,record.record_groupID]; cell.menuNameLab.text = record.record_menuName; cell.priceLab.text = record.record_menuPrice; cell.kindLab.text = record.record_menuKind;

cell.menuNumTF.text = [NSStringstringWithFormat:@\,record.record_menuNum]; cell.remarkTF.text = record.record_menuRemark;

cell.menuNumTF.userInteractionEnabled = NO; cell.remarkTF.userInteractionEnabled = NO; return cell; }

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

[tableViewdeselectRowAtIndexPath:indexPath animated:YES]; }

#pragma mark - 设置价格lab -(void)resetPriceLab {

int totalPrice = 0;

for (Record * record in_historyOrderArr) {

int price = [record.record_menuPriceintValue] * record.record_menuNum; totalPrice = totalPrice + price; }

self.priceLab.text = [NSStringstringWithFormat:@\,totalPrice]; }

#pragma mark - 关闭按钮 - (IBAction)exitClick:(id)sender {

[selfdismissViewControllerAnimated:YEScompletion:nil]; }

附录H:

35

河北地质大学本科生毕业设计

- (void)viewDidLoad {

[superviewDidLoad];

self.rightOptionTableView.rowHeight = 100;

self.rightOptionTableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.rightOptionTableView.backgroundColor = [UIColorclearColor];

_groupArr = [DataBaseToolsearchGroupTable]; [_groupArrretain];

[selfloadMenuVCWithIndex:0]; }

#pragma mark - 表的协议方法

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return_groupArr.count; }

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

staticNSString * cellIdentifier = @\;

UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell =

[[[UITableViewCellalloc]initWithStyle:UITableViewCellStyleValue1reuseIdentifier:cellIdentifier]autorelease]; }

cell.backgroundColor = [UIColorclearColor];

cell.selectionStyle = UITableViewCellSelectionStyleNone;

Group * group = [_groupArrobjectAtIndex:indexPath.row]; if (_currentRow == indexPath.row) {

cell.imageView.image = [UIImageimageNamed:group.group_highlightImage]; } else {

cell.imageView.image = [UIImageimageNamed:group.group_image]; }

return cell;

36

河北地质大学本科生毕业设计

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

_currentRow = indexPath.row;

[self.rightOptionTableViewreloadData];

[selfloadMenuVCWithIndex:indexPath.row]; }

#pragma mark - 加载点菜界面

-(void)loadMenuVCWithIndex:(int)index {

//点菜界面

[_menuVC.viewremoveFromSuperview];

if (index == 0) {

_menuVC = [[ChefViewControlleralloc]init]; } else {

_menuVC = [[MenuViewControlleralloc]init]; }

_menuVC.rightTB_selectRow = index;//传值

_menuVC.group = [_groupArrobjectAtIndex:index];

[self.viewaddSubview:_menuVC.view];

//将右侧选项卡放到最上面

[self.viewbringSubviewToFront:self.rightOptionTableView]; }

附录I:

- (void)viewDidLoad {

[superviewDidLoad];

[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(changeLab) name:@\object:nil];

#pragma mark - 设置标题图片

37


基于iOS的电子菜单设计与实现--毕业论文 - 图文(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:双金属带锯条常见故障及解决办法 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: