iOS入门教程之打开照相机与本地相册选择图片


如下图所示 在本地相册中选择一张图片后,我们将他拷贝至沙盒当中,在客户端中将它的缩略图放在按钮旁边,这个结构其实和新浪微薄中选择图片后的效果一样。最终点击发送将按钮将图片2进制图片上传服务器。

源码下载地址

免费下载地址在 http://linux.bkjia.com/

用户名与密码都是www.bkjia.com

具体下载目录在 /2014年资料/3月/6日/iOS入门教程之打开照相机与本地相册选择图片

下载方法见

下面我们仔细学习具体的细节。创建一个空的IOS项目,接着在创建一个ViewController。

AppDelegate.h 应用的代理类 这个没什么好说的就是直接打开刚刚创建的新ViewController。

AppDelegate.h 应用的代理类 这个没什么好说的就是直接打开刚刚创建的新ViewController。

#import <UIKit/UIKit.h>

#import "TestViewController.h"

 

@interface AppDelegate : UIResponder <UIApplicationDelegate>

 

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) UINavigationController *navController;

@property (strong, nonatomic) UIViewController *viewController;

@end

 

pDelegate.m 在这里就是打开我们创建的TestViewController

#import "AppDelegate.h"

 

@implementation AppDelegate

 

@synthesize window = _window;

@synthesize navController;

@synthesize viewController;

 

- (void)dealloc

{

[_window release];

[super dealloc];

}

 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

 

self.window.backgroundColor = [UIColor whiteColor];

self.viewController = [[TestViewController alloc]init];

self.navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];

[self.window addSubview:navController.view];

 

[self.window makeKeyAndVisible];

return YES;

}

 

@end 

  • 1
  • 2
  • 下一页

相关内容

    暂无相关文章