斯坦福iPhone 应用开发课程(2010年冬)PPT翻译03_C_ustom+Classes+ED
iPhoneSDKlesson4-PPT精选文档

View = Your Controller’s minions
MVC的交流模式
mvc小结
将一个应用程序划分为3个功能部分 Model
管理应用程序数据和状态,不理会用户界面或者表现方式
常常存于某处 View
向用户显示模型对象
通过对事件的反应来允许用户操作数据
Controller
协调模型和视图,当模型改变时保持视图更新,等等。
通常是应用程序的"逻辑"所在。
Interface Builder和 Nib文 件
nib文件 - 设计阶段
在ibБайду номын сангаас,程序员可以 设计界面
应用程序的生命周期
main函数
#import <UIKit/UIKit.h> int main(int argc, char *argv[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; }
动、内存不够了或者应用程序结束等,让这些事件发
生时,应用程序委托去响应。
委托
委托是一种简单而强大的模式。在此模式中,程序中的一个对象 代表另外一个对象执行某个动作,或者与之相互协作共同完成某 个任务。发布委托的对象持有其他对象(委托)的引用。在适当 的时候,它会向委托发送消息。消息用于通知委托对象发布委托 的对象将要处理或者已经处理某个事件。作为响应,委托对象会 更新外观或者更新自身或应用程序其他对象的状态。在某些情况 下,委托对象也可以返回一个值,通过它来影响事件(即将被处 理的事件)的处理方式。
11-Classes

• object: Entity that combines state and behavior.
– object-oriented programming (OOP): Programs that perform their behavior as interactions between objects. – abstraction: Separation between concepts and details. Objects provide abstraction in programming.
7
A class declaration
class ClassName { public: ClassName(parameters); // in ClassName.h
// constructor
returnType name(parameters); // member functions returnType name(parameters); // (behavior inside returnType name(parameters); // each object) private: type name; type name; };
ba1 name = "Marty" balance = 1.25
ba2
name = "Mehran" balance = 9999.00
• Think of an object as a way of grouping multiple variables.
– Each object contains a name and balance field inside iቤተ መጻሕፍቲ ባይዱ. – We can get/set them individually. – Code that uses your objects is called client code.
苹果APP开发 iOS应用开发高级(一) iOS开发第一季

江西省南昌市2015-2016学年度第一学期期末试卷(江西师大附中使用)高三理科数学分析一、整体解读试卷紧扣教材和考试说明,从考生熟悉的基础知识入手,多角度、多层次地考查了学生的数学理性思维能力及对数学本质的理解能力,立足基础,先易后难,难易适中,强调应用,不偏不怪,达到了“考基础、考能力、考素质”的目标。
试卷所涉及的知识内容都在考试大纲的范围内,几乎覆盖了高中所学知识的全部重要内容,体现了“重点知识重点考查”的原则。
1.回归教材,注重基础试卷遵循了考查基础知识为主体的原则,尤其是考试说明中的大部分知识点均有涉及,其中应用题与抗战胜利70周年为背景,把爱国主义教育渗透到试题当中,使学生感受到了数学的育才价值,所有这些题目的设计都回归教材和中学教学实际,操作性强。
2.适当设置题目难度与区分度选择题第12题和填空题第16题以及解答题的第21题,都是综合性问题,难度较大,学生不仅要有较强的分析问题和解决问题的能力,以及扎实深厚的数学基本功,而且还要掌握必须的数学思想与方法,否则在有限的时间内,很难完成。
3.布局合理,考查全面,着重数学方法和数学思想的考察在选择题,填空题,解答题和三选一问题中,试卷均对高中数学中的重点内容进行了反复考查。
包括函数,三角函数,数列、立体几何、概率统计、解析几何、导数等几大版块问题。
这些问题都是以知识为载体,立意于能力,让数学思想方法和数学思维方式贯穿于整个试题的解答过程之中。
二、亮点试题分析1.【试卷原题】11.已知,,A B C 是单位圆上互不相同的三点,且满足AB AC →→=,则AB AC →→⋅的最小值为( )A .14-B .12-C .34-D .1-【考查方向】本题主要考查了平面向量的线性运算及向量的数量积等知识,是向量与三角的典型综合题。
解法较多,属于较难题,得分率较低。
【易错点】1.不能正确用OA ,OB ,OC 表示其它向量。
2.找不出OB 与OA 的夹角和OB 与OC 的夹角的倍数关系。
移动应用开发的项目与实践培训ppt

定期进行安全漏洞扫描和代码审计,及时修复安 全问题。
05
移动应用开发案例分析
成功案例分析
美团外卖
美团外卖通过提供便捷的外卖订购服 务,满足了大量消费者的需求,实现 了商业成功。其成功的关键在于精准 的市场定位和用户体验的持续优化。
Instagram以图片分享为核心功能, 迅速占领了市场,成为社交媒体领域 的佼佼者。其成功的原因在于创新的 用户体验和强大的社区建设。
熟悉Android Studio开 发环境:Android Studio是谷歌官方推荐 的集成开发环境,包含 了开发Android应用程 序所需的所有工具和插 件。
理解MVC、MVVM和 MV*设计模式:与iOS 开发类似,MVC、 MVVM和MV*也是帮助 开发者更好地组织和管 理代码的设计模式。
实践方法
利用性能分析工具(如Android Studio的Profiler工具)进行性能 分析,找出瓶颈并进行优化。
性能测试
在多种设备和网络环境下进行测试,确保应用在不同环境下都能稳 定运行。
安全最佳实践
安全原则
保护用户数据和隐私,遵循最小权限原则,防范 恶意攻击和数据泄露。
安全实践
使用安全的编码实践,避免常见的安全漏洞(如 SQL注入、跨站脚本攻击等)。
失败案例分析
Color
Color是一款社交应用,曾获得大量投资,但由于缺乏明确的市场定位和用户 粘性,最终失败。失败的主要原因是缺乏可持续的商业模式和有效的用户增长 策略。
Vine
Vine以短视频分享为核心功能,一度受到用户喜爱,但随着竞争加剧和内容质 量下降,用户流失严重,最终关闭。失败的主要原因是未能持续创新和提升用 户体验。
iOS开发基础教程_PPT

第一章 iOS开发环境介绍
1.1.2、Mac OS 介绍 Mac OS的历史非常悠久,上世纪80年代就有了,其率先实现了窗口系统,并影响了微软的Windows的设 计。Mac OS自乔布斯回归苹果后,架构发生了很大的改变,使用了NextStep(乔布斯出走苹果后创办的 一家软件公司的名字)的软件,现在的Cocoa库(即苹果官方开发框架之名)中的众多NS开头的方法,
Mac就O是SN的ex历tS史tep非的常首字悠母久缩,写上。世尤纪其8是0年后来代转就用有in了te,l的其CP率U后先,实将现底了层窗的内口核系改统为,U并NIX影的响内了核,与Free BSD 微了软N( 接 气e的xU近 ,tNWS, 有IitXne自了移dp此众(o植w多M到s乔的a的普布c 设OU通斯NS计P开IX出C/始机。L走in在后Mua苹程的xc的果序一O软S后员个自件中衍创乔,非生办非布常系的常斯流统一受行,回家开,非归发软常 因苹人件著 为果员名 其公后的, 既司,青与 有的睐架之 着名。构齐 华字名 丽发)的 而生的还 舒了软有 适很的N件大e操t,的B作现SD改界在,O变面p的,e,nC更使oBcS接D用oa)上的了关UN系IX最的为地 库(即苹果官方开发框架之名)中的众多NS开头的方法,就是NextStep的首字母缩
iOS 开发教程
ADD YOUR TITLE HERE
目录
1 iOS 开发环境介绍 2 第一个 iOS 应用- “hello,woeld” 3 Cocoa Touch框架的运行机制与开发流程 4 iOS开发命名习惯与约定
目录
5 iOS用户界面元素之UIView与控件 6 导航控制器 7 故事板Storyboard与页面跳转 8 提醒用户
写。尤其是后来转用intel的CPU后,将底层的内核改为UNIX的内核,与Free BSD (UNIX移植到普通PC机后的一个衍生系统,非常著名,与之齐名的还有Net
iPhone 开发秘籍

第四章4.1 通过警告直接与用户对话可以通过UIActionSheet和UIAlertView对象与用户对话。
它们通过弹出或在其他视图上方滚动来发送消息。
这些轻量级类向应用程序中添加双向对话。
警告直观地与用户“对话”并且可以提示用户回答。
应用程序在屏幕上显示警告,获取用户确认,然后关闭警告继续进行其他任务。
如果你认为警告只不过是附带OK按钮的消息(如图4-1所示),那么这样的结论值得反思。
UIAlertSheet对象提供了丰富的功能(假设苹果公司继续让你访问这些丰富的功能)。
借助警告表,你可以实际构建菜单、文本输入、查询以及更多内容。
遗憾的是,此行为多半都被归类为文档中未记录或几乎未记录的类别。
在本章的秘诀中,你将了解如何创建可以在自己程序中使用的各种实用的警告。
本章中涉及的大部分功能已从正式的SDK中删除,但在公共框架中仍然存在。
由于本章更多地依赖于“非正式”调用,因此应该找到可靠性和功能之间的最佳平衡点。
苹果公司不鼓励开发人员使用私有例程,因为开发人员会随意更改这些例程。
但其本质与Mac OS X相同。
如果你知道如何在公共架构中使用私有例程的方法,则可以使用它们。
在应用程序中访问私有框架则是错误的做法。
说明在早期版本的iPhone固件中,UIActionSheet和UIAlertView实际上由相同的UIAlertSheet类实现。
该类不仅提供弹出警告,而且还提供菜单功能。
然后苹果公司将警告表替换为UIModalView,并对来自该基类的这些新对象进行子类化。
之后,苹果公司删除了UIModalView,在新版本的SDK中,UIActionSheet和UIAlertView 不再由此类派生。
(它们都来自于UIView。
)与其前身一样,它们在行为方面仍然属于同类,并且使用相似的底层技术在屏幕上呈现自己。
4.1.1 记录结果由于printf非常简单,因此大部分秘诀都使用printf以可以查看的格式输出它们的结果。
Lecture 16 Slides
Stanford CS193p Developing Applications for iOSWinter 2015T odayCameraTrax Demo-Add an image to a waypointPersistenceArchivingSQLiteFile SystemCore DataTrax Demo-Store a waypoint image added by the user in thefile system Embed SeguePutting an MVC’s View as a subview of another MVC’s ViewTrax Demo-Show a“mini-map”of the waypoint when viewing its imageModal view to get media from camera or photo libraryi.e.,you put it up with presentViewController(animated:completion:)Usage1.Create it&set its delegate(it can’t do anything without its delegate)2.Configure it(source,kind of media,user edibility)3.Present it4.Respond to delegate methods when user is done/cancels picking the mediaWhat the user can do depends on the platformAlmost all devices have cameras,but some can record video,some can notYou can only offer camera or photo library on iPad(not both together at the same time)As with all device-dependent API,we want to start by check what’s available…class func isSourceTypeAvailable(sourceType:UIImagePickerControllerSourceType)->Bool Source type is.PhotoLibrary or.Camera or.SavedPhotosAlbum(camera roll)But don’t forget that not every source type can give videoSo,you then want to check...class func availableMediaTypesForSourceType(UIImagePickerControllerSourceType)->NSArray Depending on device,will return one or more of these...kUTTypeImage//pretty much all sources provide this,hardly worth checking for even kUTTypeMovie//audio and video together,only some sources provide thisThese are declared in the MobileCoreServices framework.!import MobileCoreServicesBut don’t forget that not every source type can give videoSo,you then want to check...class func availableMediaTypesForSourceType(UIImagePickerControllerSourceType)->NSArray Depending on device,will return one or more of these...kUTTypeImage//pretty much all sources provide this,hardly worth checking for even kUTTypeMovie//audio and video together,only some sources provide thisYou can get even more specific about cameras(Though usually this is not necessary)class func isCameraDeviceAvailable(UIImagePickerControllerCameraDevice)->BoolUIImagePickerControllerCameraDevice.Rear or.FrontThere are other camera-specific interrogations too,for example…class func isFlashAvailableForCameraDevice(UIImagePickerControllerCameraDevice)->BoolSet the source and media type you want in the pickerExample setup of a picker for capturing video(kUTTypeMovie)…(From here out,UIImagePickerController will be abbreviated UIIPC for space reasons.)let picker=UIImagePickerController()picker.delegate=self//self has to say it implements UINavigationControllerDelegate too if UIIPC.isSourceTypeAvailable(.Camera){picker.sourceType=.Cameraif let availableTypes=UIIPC.availableMediaTypesForSourceType(.Camera){ if(availableTypes as NSArray).containsObject(kUTTypeMovie){picker.mediaTypes =[kUTTypeMovie]//proceed to put the picker up}}}This is sort of goofy, but just roll with it.!It’s a historical artifact not only of Objective-C,!but also of the way kUTTypeImage/Movie are declared.Editabilityvar allowsEditing:BoolIf true,then the user will have opportunity to edit the image/video inside the picker. When your delegate is notified that the user is done,you’ll get both raw and edited versions. Limiting Video Capturevar videoQuality:UIIPCQualityType.TypeMedium//default.TypeHigh.Type640x480.TypeLow.TypeIFrame1280x720//native on some devices.TypeIFrame960x540//native on some devicesvar videoMaximumDuration:NSTimeIntervalPresent the pickerpresentViewController(picker,animated:true,completion:nil)On iPad,if you are not offering Camera(just photo library),you must present with popover. If you are offering the Camera on iPad,then full-screen is preferred.Remember:on iPad,it’s Camera OR Photo Library(not both at the same time). Delegate will be notified when user is donefunc imagePickerController(UIIPC,didFinishPickingMediaWithInfo info:NSDictionary){ //extract image/movie data/metadata here from info,more on the next slidepresentingViewController.dismissViewControllerAnimated(true,completion:nil)}Also dismiss it when cancel happensfunc imagePickerControllerDidCancel(UIIPC){presentingViewController.dismissViewControllerAnimated(true,completion:nil)}What is in that info dictionary?UIImagePickerControllerMediaType//kUTTypeImage or kUTTypeMovie UIImagePickerControllerOriginalImage//UIImage UIImagePickerControllerEditedImage//UIImage UIImagePickerControllerCropRect//CGRect(in an NSValue) UIImagePickerControllerMediaMetadata//Dictionary info about the image UIImagePickerControllerMediaURL//NSURL edited video UIImagePickerControllerReferenceURL//NSURL original(unedited)videoSaving taken images or video into the device’s photo libraryCheck out ALAssetsLibrary.Or you can use thefile system(though much less likely,we’ll demo this just for demo purposes). In general,much more sophisticated media capture is availableThis UIImagePickerController API is pretty simple,but more powerful API exists.Check out AVCaptureDevice.Overlay Viewvar cameraOverlayView:UIViewBe sure to set this view’s frame properly.Camera is always full screen(on iPhone/iPod T ouch anyway):UIScreen’s bounds property.But if you use the built-in controls at the bottom,you might want your view to be smaller. Hiding the normal camera controls(at the bottom)var showsCameraControls:BoolWill leave a blank area at the bottom of the screen(camera’s aspect4:3,not same as screen’s). With no controls,you’ll need an overlay view with a“take picture”(at least)button.That button should send takePicture()to the picker.Don’t forget to dismissModalViewController when you are done taking pictures.You can zoom or translate the image while capturingvar cameraViewTransform:CGAffineTransformFor example,you might want to scale the image up to full screen(some of it will get clipped).DemoLet user associate a photo with their added waypointUIImagePickerControllerPersistenceArchivingVery rarely used for persistence,but it is how storyboards are made persistent SQLiteAlso rarely used unless you have a legacy SQL database you need to access File SystemiOS has a Unixfilesystem underneath itYou can read and writefiles into it with some restrictionsCore DataAn object-oriented databasePrimary way to store data in a sophisticated applicationHooks up rather easily to iCloudArchivingThere is a mechanism for making ANY object graph persistentNot just graphs with Array,Dictionary,NSDate,etc.in them.For example,the view hierarchies you build in XcodeThose are obviously graphs of very complicated objects.Requires all objects in the graph to implement NSCoding protocolfunc encodeWithCoder(encoder:NSCoder)init(coder:NSCoder)It is extremely unlikely you will use this in this courseObviously we did not in the homework assignments.But almost certainly not in your Final Project either.There are other,simpler,(or more appropriate),persistence mechanisms.SQLiteSQL in a singlefileFast,low memory,reliable.Open Source,comes bundled in iOS.Not good for everything(e.g.not video or even serious sounds/images). Not a server-based technology(not great at concurrency,but usually not a big deal on a phone).Is used by Core Data(object-oriented database,more on that in a moment).Accessingfiles in the Unixfilesystem1.Get the root of a path into an NSURL“Documents”directory or“Caches”directory or...2.Append path components to the URLThe names of yourfiles(and the directories they reside in)3.Write to/read from thefilesUsually done with NSData or property list components.4.Manage thefilesystem with NSFileManagerCreate directories,enumeratefiles in directories,getfile attributes,deletefiles,etc.Your application sees iOSfile system like a normal UnixfilesystemIt starts at/.There arefile protections,of course,like normal Unix,so you can’t see everything.And you can only write inside your application’s“sandbox”Why?Security(so no one else can damage your application)Privacy(so no other applications can view your application’s data)Cleanup(when you delete an application,everything it has ever written goes with it)So what’s in this“sandbox”?Application bundle directory(binary,.storyboards,.jpgs,etc.).This directory is NOT writeable. Documents directory.This is where you store permanent data created by the user.Caches directory.Store temporaryfiles here(this is not backed up by iTunes).Other directories(check out NSSearchPathDirectory in the documentation).How do you get a path to these special sandbox directories?NSFileManager(along with NSURL)is the class you use tofind out about what’s in thefile system. You create an NSFileManager thenfind system directories...let fileManager=NSFileManager()let urls:[NSURL]=fileManager.URLsForDirectory(NSSearchPathDirectory,inDomain:NSUserDomainMask)There will only be one NSURL in the returned Array in iOS(different on Mac). Examples of NSSearchPathDirectory valuesNSDocumentsDirectory,NSCachesDirectory,NSDocumentationDirectory,etc.See documentation for more.NSURLBuilding on top of these system pathsNSURL methods:func URLByAppendingPathComponent(String)->NSURLfunc URLByAppendingPathExtension(String)->NSURL//e.g.“jpg”Finding out about what’s at the other end of a URLvar isFileURL:Bool//is this afile URL(whetherfile exists or not)or something else?func resourceValuesForKeys([String],error:NSErrorPointer)->[NSObject:AnyObject]? Example keys...NSURLContentAccessDateKey,NSURLIsDirectoryKey,NSURLFileSizeKeyCS193p!NSDataReading/writing binary data tofilesinit?(contentsOfURL:NSURL)func writeToURL(NSURL,atomically:Bool)->Bool//atomically means“safe write”NSFileManagerProvides utility operationsCheck to see iffiles exist;create and enumerate directories;move,copy,deletefiles;etc. Thread safe(as long as a given instance is only ever used in one thread)Examples:let manager=NSFileManager()func createDirectoryAtURL(NSURL,withIntermediateDirectories:Bool,attributes:[NSObject:AnyObject]?,//permissions,etc.error:NSErrorPointer)->Boolfunc isReadableFileAtPath(String)->BoolAlso has a delegate with lots of“should”methods(to do an operation or proceed after an error) And plenty more.Check out the documentation.Where to store data?Sometimes you need to store large amounts of data or query it in a sophisticated manner. But we still want it to be object-oriented!Enter Core DataObject-oriented database.Very,very powerful framework in iOS.It’s a way of creating an object graph backed by a databaseUsually backed by SQL(but also can do XML or just in memory).How does it work?Create a visual mapping(using Xcode tool)between database and objects.Create and query for objects using object-oriented API.Access the“columns in the database table”using@NSManaged var s on those objects.Visual MapThis is your database schema. It is created with New File…Visual MapThis is your database schema.It is created with New File…Create Entities and AttributesWhich are similar to classes and propertiesVisual MapThis is your database schema.It is created with New File…Create Entities and AttributesWhich are similar to classes and propertiesGet a UIManagedObjectContextCan either get one by clicking the Use Core Data switch when create a new Project(this will add a managedObjectContext var to your AppDelegateOr you can use UIManagedDocument(which has a managedObjectContext var too)With a context,you can create and query database objectsfunc NSEntityDescription.insertNewObjectForEntityForName(String,inManagedObjectContext:UIManagedObjectContext)->NSManagedObject let fetchedObjects=managedObjectContext.executeFetchRequest(NSFetchRequest)Setting attributes on objects from the databaseYou can set/get values with…func setValue(AnObject!,forKey:String)func valueForKey(String)->AnyObject!…or you can create a subclass(usually with same name as Entity in database)…class Photo:NSObject{@NSManaged var title:String}…and simply set and get the property…let photo=NSEntityDescription.insertNewObjectForEntityForName(“Photo”,inMan...) photo.title=“My First Photo”Table View and Core DataThere is also a helper class for hooking up a Core Data database to a UITableView NSFetchedResultsControllerIt takes an NSFetchRequest(same thing that is sent to executeFetchRequest)and ensures that the table is always showing the results of that request(even if the database changes out from under the table)The NSFetchedResultsController can implement all of your UITableViewDatasource methodsDemoStore the user’s waypoint photo in thefile systemNSFileManagerNSData’s writeToURL(atomically:)UIImageJPEGRepresentation()Putting a VC’s self.view in another VC’s view hierarchy!This can be a very powerful encapsulation technique.Xcode makes this easyDrag out a Container View from the object palette into the scene you want to embed it in. Automatically sets up an“Embed Segue”from container VC to the contained VC. Embed SegueWorks just like other segues.prepareForSegue(sender:),et.al.Putting a VC’s self.view in another VC’s view hierarchy!This can be a very powerful encapsulation technique.Xcode makes this easyDrag out a Container View from the object palette into the scene you want to embed it in. Automatically sets up an“Embed Segue”from container VC to the contained VC. Embed SegueWorks just like other segues.prepareForSegue(sender:),et.al.View Loading TimingDon’t forget,though,that just like other segued-to VCs,the embedded VC’s outlets are not set at the time prepareForSegue(sender:)is called.。
移动平台开发技术PPT课件
案例二:React Native应用开发
总结词
React Native是一种基于React的移动应用开发框架,使用JavaScript语言,支持iOS和 Android平台。
详细描述
React Native的开发使用JavaScript和React技术,通过编写组件化的代码,可以快速 构建出高性能的移动应用。React Native还提供了丰富的组件和API,包括UI组件、网 络请求、本地存储等,方便开发者进行应用开发。React Native的应用场景包括社交、
04
移动平台开发最佳实践
应用性能优化
代码优化
编写高效、简洁的代码,避免冗余和不必要的计算,提高应用的 运行效率。
资源优化
合理使用图片、音频、视频等资源,减小文件大小,提高加载速 度。
内存管理
合理管理应用内存,避免内存泄漏和过度消耗,保证应用流畅运 行。
应用安全保障
01
02
03
数据加密
对敏感数据进行加密存储 和传输,保护用户隐私和 数据安全。
金融、新闻等各个领域。
案例三:Flutter应用开发
要点一
总结词
Flutter是一种由Google开发的跨平台移动应用开发框架, 使用Dart语言,支持iOS和Android平台。
要点二
详细描述
Flutter的开发使用Dart语言和Flutter框架,通过编写组件化 的代码,可以快速构建出高性能的移动应用。Flutter还提供 了丰富的组件和API,包括UI组件、网络请求、本地存储等, 方便开发者进行应用开发。Flutter的应用场景包括金融、新 闻、电商等各个领域。
06
移动平台开发案例分析
案例一:微信小程序开发
10天掌握iOS开发之Day3 - iPhone App Development 2 View
Lesson 2. 窗口与视图
10年8月24日星期二
IPHONE APP视图层概览
• 在iPhone App里,window和view是构成用户界面的主要视
觉组件
• window为App的显示提供背景和平台 • view用来构建显示的内容
10年8月24日星期二
UIWINDOW
入的subview显示在越上层
• superview具有管理它的直接subview的义务,包括: • 为subview定位和调整大小 • 响应subview不响应的触摸事件
10年8月24日星期二
视图的功能与责任
• 绘图与动画 • 在它们的矩形边界内绘制要显示的内容 • 可以通过动画来表示一些参数的改变 • 响应事件 • 接受触摸事件 • 广泛参与事件响应链
(subview)
• 被嵌入的view称做父视图(superview) • view通过被称为“视图树”(view
hierarchy)的机制来组织
它的subview
• 一个view中可以嵌入任意多个subview
10年8月24日星期二
视图的层次结构
• subview在显示到屏幕上时,是位于superview上面的 • 同一个view中的subview是按照嵌入顺序显示的,越晚加
•
UIView *blueView = [[UIView alloc] initWithFrame:blueFrame]; blueView.backgroundColor = [UIColor blueColor]; // Add the square views to the window [window addSubview:redView]; [window addSubview:blueView]; // Once added to the window, release the views to avoid the // extra retain count on each of them. [redView release]; [blueView release]; // Show the window. [window makeKeyAndVisible]; }
10天掌握iOS开发之Day5 - iPhone App D
定制单元格 - 自定义视图• contentView • backgroundView • selectedBackgroundView • 可以直接给当前单元格(UITableViewCell增加子view 10年9月1日星期三
下节预告• 下节课我们将了解触摸事件的基本原理,并学习如何对常见的手势进行检测和处理。
10年9月1日星期三
课后习题• 建立工程实现一个带照片的名片夹程序,要求:• • 以Navigation Controller为底层控制器主界面是一个TableView,显示以首字母区分section的联系人简表每个cell中显示联系人头像、姓名和电话号码点击cell进入该联系人的详细信息界面,显示联系人头像大图、姓名、职位、电话号码、电子邮件、地址等信息• • 10年9月1日星期三。