架构:

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. NYOJ 5 字符串处理 find()函数应用

    http://acm.nyist.net/JudgeOnline/problem.php?pid=5 #include<stdio.h> #include<iostream> ...

  2. 细微之处:比较两种CSS清除浮动的兼容

    http://www.cnblogs.com/bienfantaisie/archive/2011/05/27/2059597.html 清除浮动是连续浮动元素之后的必备工作,在工作中我做到需要清除浮 ...

  3. ios7技巧:你需要掌握的19个iOS7使用技巧

    从右往左滑动屏幕,可看到信息收到的时间. 指南针应用还可以用作水平仪,滑动屏幕即可. 被苹果称作Spotlight的搜索功能有所改变.在屏幕中间向下滑动即可打开该项功能,你可以搜索文本.邮件.应用.歌 ...

  4. 基础知识《二》java的基本类型

    一.java基本数据类型 Java基本类型共有八种,基本类型可以分为三类,字符类型char,布尔类型boolean以及数值类型byte.short.int.long.float.double.数值类型 ...

  5. 【leetcode】Palindrome Partitioning II

    Palindrome Partitioning II Given a string s, partition s such that every substring of the partition ...

  6. spring无法扫描jar包的问题

    在日常开发中往往会对公共的模块打包发布,然后调用公共包的内容.然而,最近对公司的公共模块进行整理发布后.spring却无法扫描到相应的bean.折腾了好久,最终发现是认识上的误区. 2015-11-1 ...

  7. Android 中的Force Close

    今天写程序时遇到一个问题,领导希望在点击了setting里的force close 后,程序依然能够响应以前用alarmManager注册的receiver. 在网上看到了一些文章,写的是如何建立一个 ...

  8. Ubuntu 14.04的vim编辑器配置Python开发环境

    #1 $ sudo apt-get install exuberant-ctags vim-scripts $ vim-addons install taglist #2 到:http://www.v ...

  9. 项目总结(四)--- 网络封包分析工具Charles

    Charles是Mac下一款截取网络封包的工具,主要原理就是将自己设置成为熊网络访问的代理服务器,这样的话,所有的网络请求都得通过它来完成,从而实现网络封包的拦截分析. 这款软件功能整体来说还是非常强 ...

  10. Android之智能问答机器人

    本文主要利用图灵机器人的接口,所做的一个简单的智能问答机器人 实现 由于发送与接收消息都是不同的listView,所以要用有两个listVeiw的布局文件 接收消息布局文件 <?xml vers ...