架构:

logo: logo标识(在image文件夹中修改某图片名称为icon)

default: 默认页面的启动效果(在image文件夹中修改某图片名称为Default)

image:存放图片(根目录下)

4个UIViewController: CategoryViewController, PlayViewController, TimerViewController , AboutUsViewController

* CategoryViewController(目录)

tableview data

* PlayViewController(播放)

* TimerViewController(定时)

* AboutUsViewController(关于)

AppDelegate : start category module(程序开始启动目录view)

5.audio

*import frameworks: audioltoolbox.frameword  & avfoundation.framework

AppDelegate.h

//
// AppDelegate.h
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import <UIKit/UIKit.h>
#import "CategoryViewController.h"
#import "PlayViewController.h"
#import "TimerViewController.h"
#import "AboutUsViewController.h" @interface AppDelegate : UIResponder <UIApplicationDelegate>
{ UIWindow *window; //button declare
UIButton *btnCategory;
UIButton *btnPlay;
UIButton *btnTimer;
UIButton *btnAboutUs; //nav
UINavigationController *navCategory;
UINavigationController *navPlay;
UINavigationController *navTimer;
UINavigationController *navAboutUs; //4 define uiviewcontroller
CategoryViewController *categoryView;
PlayViewController *playView;
TimerViewController *timerView;
AboutUsViewController *aboutUsView; UIView *viewToolBar; UIView *viewContent; }
@property (strong, nonatomic) UIWindow *window; @end

AppDelegate.m

 //
// AppDelegate.m
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import "AppDelegate.h" @implementation AppDelegate @synthesize window = _window; - (void)dealloc
{
[_window release];
[super dealloc];
} - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
//self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
//self.window.rootViewController = self.viewController; viewContent = [[UIView alloc]initWithFrame:CGRectMake(, , , )];
viewContent .backgroundColor = [UIColor clearColor];
[self.window addSubview:viewContent ];
[viewContent release]; categoryView = [[CategoryViewController alloc]init];
categoryView.view.frame = CGRectMake(, , , );
navCategory = [[UINavigationController alloc]initWithRootViewController:categoryView];
[viewContent addSubview:navCategory.view]; viewToolBar = [[UIView alloc]initWithFrame:CGRectMake(, , , )];
viewToolBar.backgroundColor = [UIColor clearColor];
[_window addSubview:viewToolBar];
[viewToolBar release]; UIImageView *viewToolBarImg = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
viewToolBarImg.image = [UIImage imageNamed:@"首页_按钮底图.png"];
[viewToolBar addSubview:viewToolBarImg];
[viewToolBarImg release]; //category view btnCategory = [UIButton buttonWithType:UIButtonTypeCustom];
btnCategory.frame = CGRectMake(, , , );
btnCategory.tag =;
[btnCategory setAdjustsImageWhenDisabled:YES];
[btnCategory setBackgroundImage:[UIImage imageNamed:@"目录.png"] forState:UIControlStateNormal];
[btnCategory addTarget:self action:@selector(categoryAction) forControlEvents:UIControlEventTouchDown];
[viewToolBar addSubview:btnCategory]; //play view btnPlay = [UIButton buttonWithType:UIButtonTypeCustom];
btnPlay.frame = CGRectMake(, , , );
btnPlay.tag =;
[btnPlay setAdjustsImageWhenDisabled:YES];
[btnPlay setBackgroundImage:[UIImage imageNamed:@"播放.png"] forState:UIControlStateNormal];
[btnPlay addTarget:self action:@selector(playAction) forControlEvents:UIControlEventTouchDown];
[viewToolBar addSubview:btnPlay]; //timer btnTimer = [UIButton buttonWithType:UIButtonTypeCustom];
btnTimer.frame = CGRectMake(, , , );
btnTimer.tag =;
[btnTimer setAdjustsImageWhenDisabled:YES];
[btnTimer setBackgroundImage:[UIImage imageNamed:@"定时.png"] forState:UIControlStateNormal];
[btnTimer addTarget:self action:@selector(timerAction) forControlEvents:UIControlEventTouchDown];
[viewToolBar addSubview:btnTimer]; //aboutus
btnAboutUs = [UIButton buttonWithType:UIButtonTypeCustom];
btnAboutUs.frame = CGRectMake(, , , );
btnAboutUs.tag =;
[btnAboutUs setAdjustsImageWhenDisabled:YES];
[btnAboutUs setBackgroundImage:[UIImage imageNamed:@"关于.png"] forState:UIControlStateNormal];
[btnAboutUs addTarget:self action:@selector(aboutusAction) forControlEvents:UIControlEventTouchDown];
[viewToolBar addSubview:btnAboutUs]; [self.window makeKeyAndVisible];
return YES;
} #pragma mark ----------category action method ----------------- -(void)categoryAction{ NSLog(@"categoryAction");
[btnCategory setBackgroundImage:[UIImage imageNamed:@"目录.png"] forState:UIControlStateNormal];//选择的效果
[btnPlay setBackgroundImage:[UIImage imageNamed:@"播放.png"] forState:UIControlStateNormal];//未选择的效果
[btnTimer setBackgroundImage:[UIImage imageNamed:@"定时.png"] forState:UIControlStateNormal];//未选择的效果
[btnAboutUs setBackgroundImage:[UIImage imageNamed:@"关于.png"] forState:UIControlStateNormal];//未选择的效果 if ((navCategory.view.hidden =YES)) {
//
navCategory.view.hidden = NO;
navPlay.view.hidden = YES;
navTimer.view.hidden = YES;
navAboutUs.view.hidden = YES;
} }
#pragma mark ----------playAction method ----------------- -(void)playAction{
NSLog(@"playAction");
if (playView == nil) {
//
playView = [[PlayViewController alloc]init];
playView.view.frame = CGRectMake(, , , );
navPlay = [[UINavigationController alloc]initWithRootViewController:playView];
[viewContent addSubview:navPlay.view];
} [btnCategory setBackgroundImage:[UIImage imageNamed:@"目录.png"] forState:UIControlStateNormal];//未选择的效果
[btnPlay setBackgroundImage:[UIImage imageNamed:@"播放.png"] forState:UIControlStateNormal];//选择的效果
[btnTimer setBackgroundImage:[UIImage imageNamed:@"定时.png"] forState:UIControlStateNormal];//未选择的效果
[btnAboutUs setBackgroundImage:[UIImage imageNamed:@"关于.png"] forState:UIControlStateNormal];//未选择的效果 if ((navPlay.view.hidden =YES)) {
//
navPlay.view.hidden = NO;
navCategory.view.hidden = YES;
navTimer.view.hidden = YES;
navAboutUs.view.hidden = YES;
} } #pragma mark ----------timerAction method ----------------- -(void)timerAction{ NSLog(@"timerAction"); if (timerView == nil) {
//
timerView = [[TimerViewController alloc]init];
timerView.view.frame = CGRectMake(, , , );
navTimer = [[UINavigationController alloc]initWithRootViewController:timerView];
[viewContent addSubview:navTimer.view];
} [btnCategory setBackgroundImage:[UIImage imageNamed:@"目录.png"] forState:UIControlStateNormal];//未选择的效果
[btnPlay setBackgroundImage:[UIImage imageNamed:@"播放.png"] forState:UIControlStateNormal];//未选择的效果
[btnTimer setBackgroundImage:[UIImage imageNamed:@"定时.png"] forState:UIControlStateNormal];//选择的效果
[btnAboutUs setBackgroundImage:[UIImage imageNamed:@"关于.png"] forState:UIControlStateNormal];//未选择的效果 if ((navTimer.view.hidden =YES)) {
//
navTimer.view.hidden = NO;
navCategory.view.hidden = YES;
navPlay.view.hidden = YES;
navAboutUs.view.hidden = YES;
} } #pragma mark ----------aboutusAction method ----------------- -(void)aboutusAction{ NSLog(@"aboutusAction");
if (aboutUsView == nil) {
//
aboutUsView = [[AboutUsViewController alloc]init];
aboutUsView.view.frame = CGRectMake(, , , );
navAboutUs = [[UINavigationController alloc]initWithRootViewController:aboutUsView];
[viewContent addSubview:nav4.view];
} [btnCategory setBackgroundImage:[UIImage imageNamed:@"目录.png"] forState:UIControlStateNormal];//未选择的效果
[btnPlay setBackgroundImage:[UIImage imageNamed:@"播放.png"] forState:UIControlStateNormal];//未选择的效果
[btnTimer setBackgroundImage:[UIImage imageNamed:@"定时.png"] forState:UIControlStateNormal];//未选择的效果
[btnAboutUs setBackgroundImage:[UIImage imageNamed:@"关于.png"] forState:UIControlStateNormal];//选择的效果 if ((navAboutUs.view.hidden =YES)) {
//
navAboutUs.view.hidden = NO;
navCategory.view.hidden = YES;
navPlay.view.hidden = YES;
navTimer.view.hidden = YES;
} }
- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
} - (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
} - (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
*/
} - (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
} - (void)applicationWillTerminate:(UIApplication *)application
{
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
} @end

CategoryViewController.h

//
// CategoryViewController.h
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import <UIKit/UIKit.h> @interface CategoryViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
{
UITableView *table;
NSArray *arr;
} @end

CategoryViewController.m

 //
// CategoryViewController.m
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import "CategoryViewController.h"
#import "CustomCell.h"
#import "PlayViewController.h" @implementation CategoryViewController #pragma mark -------UITableViewDelegate method(行高): - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return ; } #pragma mark ---点击某行触发的方法 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { PlayViewController *play = [[PlayViewController alloc]init];
//
play.arr_objindex = indexPath.row; [self.navigationController pushViewController:play animated:YES];
} #pragma mark UITableViewDataSource method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell"; CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; [cell setTheImage:[UIImage imageNamed:@"条纹.png"]]; //title
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
lbl.backgroundColor = [UIColor clearColor];
lbl.tag = indexPath.row;
lbl.textColor = [UIColor blackColor];
lbl.text = [arr objectAtIndex:indexPath.row];//arry indexPath.row
[cell addSubview:lbl]; } cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return ;//[arr count];//array count
} - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;{
return ; } - (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use.
} #pragma mark - View lifecycle /*
87 // Implement loadView to create a view hierarchy programmatically, without using a nib.
88 - (void)loadView
89 {
90 }
91 */ -(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
self.navigationController.navigationBar.hidden = YES; }
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.hidden = YES; UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
imageView.image = [UIImage imageNamed:@"Default.png"];
[self.view addSubview:imageView];
[imageView release]; arr = [[NSArray alloc]initWithObjects:@"秦朝帝王史话第一讲",@"秦朝帝王史话第二讲",@"秦朝帝王史话第三讲",@"秦朝帝王史话第四讲",@"秦朝帝王史话第五讲",@"秦朝帝王史话第六讲",@"秦朝帝王史话第七讲",@"秦朝帝王史话第八讲",@"秦朝帝王史话第九讲",@"秦朝帝王史话第十讲",@"秦朝帝王史话第十一讲",@"秦朝帝王史话第十二讲", nil]; table = [[UITableView alloc]initWithFrame:CGRectMake(, , , ) style:UITableViewStylePlain];
table.scrollEnabled = YES;
table.delegate = self;
table.dataSource = self;
table.backgroundColor = [UIColor clearColor]; table.separatorStyle = UITableViewCellSeparatorStyleNone;// 去掉cell的线
table.indicatorStyle = UIScrollViewIndicatorStyleWhite; [self.view addSubview:table]; } - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
} @end

PlayViewController.h

 //
// PlayViewController.h
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h> @interface PlayViewController : UIViewController<AVAudioPlayerDelegate>
{
AVAudioPlayer *player;
UISlider *mySlider;
UISlider *mySlider1;
SystemSoundID soundID; NSInteger arr_objindex;
NSString *str; } @property (nonatomic,retain)AVAudioPlayer *player;
@property (nonatomic,retain)UISlider *mySlider;
@property (nonatomic,retain)UISlider *mySlider1;
@property (nonatomic) NSInteger arr_objindex; -(IBAction)sliderChange1:(id)sender; @end

PlayViewController.m

 //
// PlayViewController.m
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import "PlayViewController.h" @implementation PlayViewController
@synthesize player,mySlider,mySlider1,arr_objindex; -(void)viewWillAppear:(BOOL)animated{ self.navigationController.navigationBar.hidden = YES; } -(IBAction)sliderChange1:(id)sender{ NSLog(@"sliderChange"); UISlider *slider = (UISlider *)sender;
player.currentTime = slider.value * player.duration;
NSLog(@"%f",player.currentTime); NSString *str1 = [NSString stringWithFormat:@"%f",player.currentTime];
UILabel *sliderLbl = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
sliderLbl.backgroundColor = [UIColor clearColor];
sliderLbl.textColor = [UIColor redColor];
sliderLbl.text = str1;
sliderLbl.font = [UIFont systemFontOfSize:];
[self.view addSubview:sliderLbl];
[sliderLbl release]; } - (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use.
} #pragma mark - View lifecycle /*
52 // Implement loadView to create a view hierarchy programmatically, without using a nib.
53 - (void)loadView
54 {
55 }
56 */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad]; UIImageView *bottomImg = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
bottomImg.image =[UIImage imageNamed:@"底图.png"];
[self.view addSubview:bottomImg];
[bottomImg release]; UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
img.image =[UIImage imageNamed:@"首页_时间与进度轴.png"];
[self.view addSubview:img];
[img release]; UILabel *leftLbl = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
leftLbl.backgroundColor =[UIColor clearColor];
leftLbl.text =@"-";
leftLbl.textColor = [UIColor yellowColor];
[self.view addSubview:leftLbl];
[leftLbl release]; UILabel *rightLbl = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
rightLbl.backgroundColor =[UIColor clearColor];
rightLbl.textColor =[UIColor yellowColor];
rightLbl.text = @"+";
[self.view addSubview:rightLbl];
[rightLbl release]; mySlider = [[UISlider alloc]initWithFrame:CGRectMake(, , , )];
mySlider.backgroundColor =[UIColor clearColor];
mySlider.maximumValue = 50.0;
mySlider.minimumValue = 10.0;
mySlider.value = 10.0;
[mySlider setMaximumTrackImage:[UIImage imageNamed:@"max.png"] forState:UIControlStateNormal];
[mySlider setMinimumTrackImage:[UIImage imageNamed:@"min.png"] forState:UIControlStateNormal];
[mySlider setThumbImage:[UIImage imageNamed:@"thumb.png"] forState:UIControlStateNormal];
[mySlider addTarget:self action:@selector(sliderChange1:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:mySlider]; mySlider1 = [[UISlider alloc]initWithFrame:CGRectMake(, , , )];
mySlider1.backgroundColor = [UIColor clearColor];
mySlider1.maximumValue = 50.0;
mySlider1.minimumValue = 10.0;
mySlider1.value = 22.0;
[mySlider1 setMaximumTrackImage:[UIImage imageNamed:@"max.png"] forState:UIControlStateNormal];
[mySlider1 setMinimumTrackImage:[UIImage imageNamed:@"min.png"] forState:UIControlStateNormal];
[mySlider1 setThumbImage:[UIImage imageNamed:@"thumb.png"] forState:UIControlStateNormal]; //UIControlEventValueChanged:值在变化 [mySlider1 addTarget:self action:@selector(sliderChange:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:mySlider1]; switch (arr_objindex) {
case :
//
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break; case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break;
case :
str = @"";
break; default:
break;
} if (player ==nil) {
// NSError *error = nil;
NSString *path = [[NSBundle mainBundle]pathForResource:str ofType:@"mp3"];
NSURL *url = [NSURL fileURLWithPath:path]; player = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
player.delegate = self; } [player prepareToPlay];
[player play]; [player setVolume:5.0]; }
#pragma mark -----------------control audio
-(void)sliderChange:(id)sender{ UISlider *slider = (UISlider *)sender; NSLog(@"%f",slider.value);
[player setVolume:slider.value]; } - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
} @end

TimerViewController.h

  //
// TimerViewController.h
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import <UIKit/UIKit.h>
#import "PlayViewController.h"
@interface TimerViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
{
UITableView *table;
NSArray *arr;
UILabel *timerLbl;
UISwitch *switch_;
PlayViewController *playView; } @property(nonatomic,retain)UISwitch *switch_;
-(IBAction)switchChange:(id)sender; @end

TimerViewController.m

 //
// TimerViewController.m
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import "TimerViewController.h"
#import "CustomCell.h"
@implementation TimerViewController @synthesize switch_;
@synthesize player;
-(IBAction)switchChange:(id)sender{ NSLog(@"switch change");
UISwitch *mySwitch = (UISwitch *)sender;
BOOL setting = mySwitch.isOn;//open
[switch_ setOn:setting animated:YES]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
} - (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use.
} #pragma mark - View lifecycle /*
45 // Implement loadView to create a view hierarchy programmatically, without using a nib.
46 - (void)loadView
47 {
48 }
49 */
#pragma mark -------UITableViewDelegate method(行高): - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return ; } #pragma mark ---点击某行触发的方法 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"didselect");
switch (indexPath.row) {
case :
//
playView.player.currentTime = ;
if (playView.player.duration==) {
//
[playView.player stop];
}
break; default:
break;
} } #pragma mark UITableViewDataSource method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell"; CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; [cell setTheImage:[UIImage imageNamed:@"条纹.png"]]; if (indexPath.row ==) {
// }else{ //title
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
lbl.backgroundColor = [UIColor clearColor];
lbl.tag = indexPath.row;
lbl.textColor = [UIColor blackColor];
lbl.text = [arr objectAtIndex:indexPath.row];//arry indexPath.row
[cell addSubview:lbl]; } } cell.selectionStyle = UITableViewCellSelectionStyleNone;
//cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return ;//[arr count];//array count
} - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;{
return ; }
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
self.navigationController.navigationBar.hidden = YES; }
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad]; UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
imageView.image = [UIImage imageNamed:@"Default.png"];
[self.view addSubview:imageView];
[imageView release]; arr = [[NSArray alloc]initWithObjects:@"",@"10分钟",@"20分钟",@"30分钟",@"40分钟",@"50分钟",@"60分钟",nil]; table = [[UITableView alloc]initWithFrame:CGRectMake(, , , ) style:UITableViewStylePlain];
table.scrollEnabled = YES;
table.delegate = self;
table.dataSource = self;
table.backgroundColor = [UIColor clearColor]; table.separatorStyle = UITableViewCellSeparatorStyleNone;// 去掉cell的线
table.indicatorStyle = UIScrollViewIndicatorStyleWhite; [self.view addSubview:table]; switch_ = [[UISwitch alloc]initWithFrame:CGRectMake(, , , )];
switch_.backgroundColor =[UIColor clearColor];
[switch_ addTarget:self action:@selector(switchChange:) forControlEvents:UIControlEventValueChanged]; [self.view addSubview:switch_];
} - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
} @end

AboutUsViewController.h

 //
// AboutUsViewController.h
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import <UIKit/UIKit.h> @interface AboutUsViewController : UIViewController @end

AboutUsViewController.m

  //
// AboutUsViewController.m
// novel_example
//
// Created by chenzg on 3/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import "AboutUsViewController.h" @implementation AboutUsViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
} - (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use.
} #pragma mark - View lifecycle /*
33 // Implement loadView to create a view hierarchy programmatically, without using a nib.
34 - (void)loadView
35 {
36 }
37 */ /*
40 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
41 - (void)viewDidLoad
42 {
43 [super viewDidLoad];
44 }
45 */ - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
} @end CustomCell.h //
// CustomCell.h
// novel_example
//
// Created by chenzg on 4/7/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import <UIKit/UIKit.h> @interface CustomCell : UITableViewCell
{
UIImageView *imageView; } -(void)setTheImage:(UIImage *)icon; @end

CustomCell.m

 //
// CustomCell.m
// novel_example
//
// Created by chenzg on 4/7/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
// #import "CustomCell.h" @implementation CustomCell #pragma mark---------setTheImage------ -(void)setTheImage:(UIImage *)icon{ imageView = [[UIImageView alloc]initWithImage:icon];
imageView.frame = CGRectMake(, , , );
[self.contentView addSubview:imageView]; } #pragma mark ------去除cell的背景色 -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self== [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//cell background kill [self.contentView setBackgroundColor:[UIColor clearColor]]; } return self; } -(void)setSelected:(BOOL)selected animated:(BOOL)animated{ [super setSelected:selected animated:animated]; if (selected == YES) {
//
imageView.alpha =;//cell被图片覆盖 }else{ imageView.alpha =.;//cell透明
} } - (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use.
} #pragma mark - View lifecycle /*
68 // Implement loadView to create a view hierarchy programmatically, without using a nib.
69 - (void)loadView
70 {
71 }
72 */ /*
75 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
76 - (void)viewDidLoad
77 {
78 [super viewDidLoad];
79 }
80 */ - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
} @end

IOS 项目 小说 1的更多相关文章

  1. 开源 iOS 项目分类索引大全 - 待整理

    开源 iOS 项目分类索引大全 GitHub 上大概600个开源 iOS 项目的分类和介绍,对于你挑选和使用开源项目应该有帮助 系统基础库 Category/Util sstoolkit 一套Cate ...

  2. ios项目里扒出来的json文件

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0. ...

  3. 现有iOS项目集成React Native过程记录

    在<Mac系统下React Native环境搭建>配置了RN的开发环境,然后,本文记录在现有iOS项目集成React Native的过程,官方推荐使用Cocoapods,项目一开始也是使用 ...

  4. iOS项目的本地化处理(多国语言)

    项目的本地化就是:iOS系统在不同语言环境下自动切换语言,从而实现一个app发布到全世界各个国家的AppStore上. 我们不仅仅需要在iOS项目中做本地化处理,在上架iOS APP的时候,也需要做对 ...

  5. 在Xcode 6 beta里编译Cocos2d-x iOS项目时失败

    转载 在Xcode 6 beta里编译Cocos2d-x iOS项目时可能会失败,提示如下错误: Undefined symbols for architecture i386: "_fwr ...

  6. phonegap创建的ios项目推送消息出现闪退现象

    使用phonegap创建的ios项目,推送消息时,当程序在前台运行或者在后台运行状态下,推送消息过来,可以解析并且跳转: 但是在程序从后台退出的状态下,当消息推送过来的时候,点击通知栏,打开程序,程序 ...

  7. MVVM 模式下iOS项目目录结构详细说明

    ➠更多技术干货请戳:听云博客 我们在做项目的时候,会经常用到各种设计模式,最常见的要数 MVC (模型,视图,控制器)了.但是,今天我们要说的是另一种设计模式——MVVM. 所以 MVVM 到底是什么 ...

  8. WinObjc - 使用iOS项目生成通用Windows应用

    Github上一周年的WinObjc项目最近发布了预览版本,终于等到了这一天.WinObjc项目就是Build 2015大会上微软宣布的Project IslandWood项目,致力于将iOS应用快速 ...

  9. iOS 项目中用到的一些开源库和第三方组件

    iOS 项目中用到的一些 iOS 开源库和第三方组件 分享一下我目前所在公司 iOS 项目中用到的一些 iOS 开源库和第三方组件, 感谢开源, 减少了我们的劳动力, 节约了我们大量的时间, 让我们有 ...

随机推荐

  1. Shell脚本中cd命令使用

    在写shell脚本的时候发现cd切换目录的时候无法切换,代码是下面的. #!/bin/bash #changedir.sh history cd /home/firefox sleep pwd 我仔细 ...

  2. The Perfect Stall (incomplete)

    恩,一看就知道是一道二分图最大匹配的题. 感动得发现自己不会做..果然我是太弱了.学校里真是麻烦死,根本没有时间好吗. (NOIP)会不会感动地滚粗啊? 然后稍微看看,恩,匈牙利算法. 真是感动得落泪 ...

  3. luarocks install with lua5.1 and luajit to install lapis

    # in luarocks source directory...git clone https://github.com/archoncap/luarockscd luarocks ./config ...

  4. php中global与$GLOBALS的用法及区别

    php中global 与 $GLOBALS[""] 差别 原本觉得global和$GLOBALS除了写法不一样觉得,其他都一样,可是在实际利用中发现2者的差别还是很大的! 先看下面 ...

  5. Linux 之 最常用的20条命令

    玩过Linux的人都会知道,Linux中的命令的确是非常多,但是玩过Linux的人也从来不会因为Linux的命令如此之多而烦恼,因为我们只需要掌握我们最常用的命令就可以了.当然你也可以在使用时去找一下 ...

  6. object-c 系列教程

    1.object-c 基本数据类型 2.object-c 控制语句 3.object-c面向对象1 4.object-c面向对象2 5.object-c 继承多态 动态数据类型

  7. java Long的iniValue出错

    Long l1 = 2500000000L; l1.intValue() 的值是负数 这里 System.out.println(Integer.MAX_VALUE); // 2147483647最大 ...

  8. [Android Pro] Android fastboot刷机和获取Root权限

    参考文章: https://developers.google.com/android/nexus/images 转载自:    http://www.inexus.co/article-1280-1 ...

  9. KMP模式匹配_2

    http://blog.csdn.net/lin_bei/article/details/1252686 三. 怎么求串的模式值next[n] 定义: (1)next[0]= -1 意义:任何串的第一 ...

  10. 3.工厂方法模式(Factory Method)

    using System; using System.Reflection; namespace ConsoleApplication1 { class Program { static void M ...