Archive for the ‘源代码’ Category.
2009年11月2日, 12:21 上午
说来一个多月都没有更新自己的博客了,好多朋友都在支持我,鼓励我的博文,自己很开心。
生计的问题基本得到了解决,感情的问题也不再是问题(被人爱的感觉好阿!)所以之后一旦有时间是继续写博客。自己倒是没从开发中赚多少钱,但是希望大家有钱赚,希望大家从中获益就好。
我享受开发的乐趣!
噢,源代码MyFodian0.4 话说这个程序还是非常粗糙的,不过对于初学者来说会是一个不错的实例。大家自己如果想编译,记得先更改320库的位置。如果320库工作不正常,就要麻烦你们自己改改那个MockDataSource了,因为320的版本更新快,很多东西都有可能会不好用。
预告一下,很多朋友都提了问题,有空归纳一下然后一起回答~ 挑会的答,嘿嘿
2009年08月20日, 6:11 下午
本程序源代码,不包含视频文件
视频播放在iPhone中是再重要不过了,今天要在30行内解决iPhone视频播放的问题!
1,建立工程MPtest1

2, 建立一个UIViewController类 MyMPViewController

3, 设置MPtest1AppDelegate初始化并添加MyMPViewController的view到window
@interface MPtest1AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
MyMPViewController *mpViewController;
}
@end
- (void)applicationDidFinishLaunching:(UIApplication *)application {
mpViewController = [[MyMPViewController alloc] init];
[window addSubview:mpViewController.view];
[window makeKeyAndVisible];
}
4, 设置MyMPViewController在一个按钮点击后播放视频
@interface MyMPViewController : UIViewController {
UIButton *playButton;
}
@end
@interface MyMPViewController()
- (void)playVideo;
@end
@implementation MyMPViewController
- (id)init
{
if (self = [super init]) {
playButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
//在这里初始化那个按键
playButton.frame = CGRectMake(100, 100, 100, 30);
[self.view addSubview:playButton];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[playButton setTitle:@"播放" forState:UIControlStateNormal];
[playButton addTarget:self action:@selector(playVideo) forControlEvents:UIControlEventTouchUpInside];
//设置按键属性,然后添加点击后触发的方法函数
}
- (void)playVideo
{
MPMoviePlayerController *moviePlayer;
moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"]]];
//初始化视频播放器对象,并传入被播放文件的地址
moviePlayer.movieControlMode = MPMovieControlModeDefault;
[moviePlayer play];
//此处有内存溢出,简单程序就先算了...
}
- (void)dealloc {
[playButton release];
[super dealloc];
}
@end
5, 编译运行
————————————————
整个程序非常简单,排除掉没有用的,必须用的,真正MP播放的部分也不到10行。
简单iPhone视频播放器(1)补
2009年08月9日, 4:28 下午
我作了一个iPhone版本的随机数生成器,希望大家喜欢
>>>>RandomNumber<<<<
其实就是很简单的利用 random() 函数计算,和简单的UISlider的使用
