在好例子网,分享、交流、成长!
您当前所在位置:首页C/C++ 开发实例iPhone手机开发 → ios点菜系统源码下载

ios点菜系统源码下载

iPhone手机开发

下载此实例
  • 开发语言:C/C++
  • 实例大小:2.53M
  • 下载次数:36
  • 浏览次数:501
  • 发布时间:2014-05-16
  • 实例类别:iPhone手机开发
  • 发 布 人:cnsilan
  • 文件格式:.zip
  • 所需积分:2
 相关标签: 点菜系统

实例介绍

【实例简介】
【实例截图】

【核心代码】

//
//  MenuViewController.m
//  SUSHIDO
//
//  Created by WANG Mengke on 10-6-29.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "MenuViewController.h"
#import "FileManagerController.h"
#import "TableCellBGView.h"
#import "MenuPagingViewController.h"
#import "SUSHIDOAppDelegate.h"

@implementation MenuViewController


#pragma mark -
#pragma mark Initialization

- (id)initWithStyle:(UITableViewStyle)style{
	self = [super initWithStyle:style];
	if (self) {
        self.tabBarItem.title = @"Menu";
		UIImage *image = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"LOGO.png"]];
		UIImageView *logoImageView = [[UIImageView alloc] initWithImage:image];
		[image release];
		self.navigationItem.titleView = logoImageView;
		[logoImageView release];
		
		UIImage *imageTab = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"TAB_ICON_MENU.png"]];
		self.tabBarItem.image = imageTab;
		[imageTab release];
		
		self.navigationItem.title=@"SUSHIDO";
		//self.navigationController.navigationBarHidden = NO;
		
		mMenus = [[NSArray alloc] initWithArray:[FileManagerController allContentsInPath:[[FileManagerController documentPath] stringByAppendingPathComponent:@"menu"]]];

		UIImage *titleImage = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MenuTitle.png"]];
		UIImageView *titleView = [[UIImageView alloc] initWithImage:titleImage];
		[titleImage release];
		[titleView setFrame:CGRectMake(0, 0, titleImage.size.width, titleImage.size.height)];
		[self.tableView setTableHeaderView:titleView];
		[titleView release];
		
		[self.tableView setSeparatorColor:[UIColor whiteColor]];
		[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    }
    return self;
}

- (void)dealloc {
	[mMenus release];
    [super dealloc];
}

/*
- (id)initWithStyle:(UITableViewStyle)style {
    // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
    if ((self = [super initWithStyle:style])) {
    }
    return self;
}
*/


#pragma mark -
#pragma mark View lifecycle

/*
- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
*/

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
	[self.view setBackgroundColor:[UIColor clearColor]];
	[(SUSHIDOAppDelegate *)[[UIApplication sharedApplication] delegate] resetBGView];
}

/*
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}
*/
/*
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/


#pragma mark -
#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 [mMenus count];
}

- (CellStyle)checkCellStyleWith:(NSArray *)_datasource Index:(NSInteger)_index
{
	NSInteger _count = [_datasource count];
	if (_count > 0) {
		if (_count > 1) {
			if (_index == 0) {
				return CellStyle_Top;
			}
			if (_index == _count - 1) {
				return CellStyle_Bottom;
			}
			return CellStyle_Middle;
		}
		return CellStyle_Single;
	}
	return CellStyle_None;
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
		[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
		cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
	
	TableCellBGView *bgView = [[TableCellBGView alloc] init];
	bgView.theCellStyle = [self checkCellStyleWith:mMenus Index:indexPath.row];
	[cell setBackgroundView:bgView];
	[bgView release];
	
	[cell setBackgroundColor:[UIColor redColor]];
	[cell.textLabel setBackgroundColor:[UIColor clearColor]];
	cell.textLabel.text = [mMenus objectAtIndex:indexPath.row];
	
	[cell.detailTextLabel setBackgroundColor:[UIColor clearColor]];
	cell.detailTextLabel.text = @"detailTextLabel";
	
	return cell;
}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/


/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/


/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/


/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/


#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.
	NSString *path = [[[FileManagerController documentPath] stringByAppendingPathComponent:@"menu"] stringByAppendingPathComponent:[mMenus objectAtIndex:indexPath.row]];
	
	MenuPagingViewController *menuScrollViewController = [[MenuPagingViewController alloc] initWithPath:path
																												   tabTitle:nil 
																											navigationTitle:nil];
	[self.navigationController pushViewController:menuScrollViewController animated:YES];
	[menuScrollViewController release];
}


#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}


@end

标签: 点菜系统

实例下载地址

ios点菜系统源码下载

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警