技术开发 频道

iOS开发笔记 3、iOS基础

  Core Location framework

  NS CLASS

  The NS classes come from Core Services’Foundation framework (the Cocoa equivalent of the Core Foundation framework), which contains a huge number offundamental data types and other objects.

  根对象NSObject

  THE UI CLASSES

  The second broad category contains the UI classes. These come from Cocoa Touch’s UIKit framework, which includes all the graphical objects you’ll be using as well as all the functionality for the iPhone OS’s event model, much of which appears in UIResponder.

  Window , View, view controllers

  A window is something that spans the device’s entire screen. An application has only one, and it’s the overall container for everything your application does.

  A view is the content holder in your application. You may have several of them, each covering different parts of the window or doing different things at different times. They’re all derived from the UIView class. But don’t think of a view as a blank container. Almost any object you use from the UIKit will be a subclass of UIView that features a lot of behavior of its own. Among the major subclasses of UIView are UIControl, which gives you buttons, sliders, and other items with which users may manipulate your program, and UIScrollableView, which gives users access to more text than can appear at once.

  A view controller does what its name suggests. It acts as the controller element of the Model-View-Controller triad and in the process manages a view, sometimes called an application view. As such, it takes care of events and updating for your view.

  对象创建

  idnewObject = [[objectClassalloc] init];

  常见的子类重写init方法

  - (id)init

  {

  if (self = [super init]) {

  // Instance variables go here

  }

  return self;

  }

  带参数的初始化方法

  [[UITextViewalloc] initWithFrame:textFieldFrame];

  一个特殊的方法:Interface Builder中使用

  initWithCoder:

  工厂方法:

  [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

iOS开发笔记 3、iOS基础(下)

0
相关文章