swift语言编程-关于swift

关于swift

swift是一个在c和oc基础上产生的新语言,swift语言安全、时尚、简单、灵活、有趣,并且和Cocoa、Cocoa Touch框架紧密连接,是居家旅行、杀人越货、开发ios的不二选择。

swift语言从多年前就在研究了,苹果现有的编译技术、调试技术、和框架,奠定了swift的基础,我们使用自动引用技术简化了内存管理,swift所使用的类库也是在Foundation和Cocoa这两个现代标准的牛逼框架上实现的。oc现在已经支持块、集合、模块、使用现代技术不中断,尽管oc已经这么牛逼了,但我们还是为苹果产品线的软件开发准备了更牛逼的语言,嗯,就是swift。

swift对于oc开发人员来说太熟悉了,它采用了一些和oc相同的语法,可以和oc互相调用,然后增加了一些面向对象的新特性。swift对初学者也是很容易的,它支持所见即所得功能,写了代码立刻能看到执行结果。swift结合了现代编程语言特性和苹果公司的工程师文化,编译器为性能做了很多优化,语言上也做了很多优化来避免任何取舍,它被设计成从写“hello world”这样的简单程序到庞大的操作系统,这一切使得swift听起来非常值得开发者和苹果公司为之投入。

swift语言是编写ios和osx应用的最佳语言,并且我们会持续扩展发布swift的新功能,我们对swift的规划是雄心勃勃的,“我们都等不及你用它来做什么了”!

 

这篇可以理解为,swift语言各种牛逼,oc虽然也很牛逼,但毕竟得忍受c的各种约束,所以oc可以去死了,把未来交给swift吧。。。

 

ios开发从相机、相册、图片库选择图片(转)


– (void)selectImage
{
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@”选 择 图 片”
delegate:self cancelButtonTitle:@”取消”
destructiveButtonTitle:nil otherButtonTitles:@”拍照”,@”相册”,@”图片库”,nil];

actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView: self.view];
[actionSheet release];
}


– (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
UIImagePickerController *picker=[[UIImagePickerController alloc]init];
picker.delegate=self;
picker.allowsEditing=YES;

switch (buttonIndex)
{
case 0:
{
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
{
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
}
else
{
return;
}
}
break;
case 1:
{
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary])
{
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
}
}

break;
case 2:
{
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
picker.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
}
break;
default:
{
return;
}
break;
}
UIPopoverController * popOver = [[UIPopoverController alloc]initWithContentViewController: picker];
[picker release];
popOver.delegate = self;
self.popOverController = popOver;
[self.popOverController presentPopoverFromRect:CGRectMake(0,100, 0, 0) inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}


– (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self.popOverController dismissPopoverAnimated:YES];
UIImage *image=[info objectForKey:UIImagePickerControllerEditedImage];
[selectButton  setBackgroundImage: image forState: UIControlStateNormal];
}


– (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self.popOverController dismissPopoverAnimated:YES];
}

原文地址:http://qing.weibo.com/1655094660/62a6bd8433000ius.html

斯坦福公开课-ipad&iphone应用开发备注

课程主页:http://www.stanford.edu/class/cs193p/
Itunes地址:http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=473757255
讲义、示例、作业:http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2011-fall
网易公开课翻译:http://v.163.com/special/opencourse/ipadandiphoneapplication.html