Fundamentals
chuanyituoku
这个作者很懒,什么都没留下…
展开
-
Reading Text from Text Field
pp105 property - (void)Done { NSLog(@"Contents of the text field: %@",self.textField.text); //close the window [self.presentingViewControllerdismissViewControllerAnimated:YES原创 2013-03-06 00:37:10 · 635 阅读 · 0 评论 -
Let the label display variable values on screen
To do that, we need to accomplish two things: 1 Create a reference to the label so we can send it messages. 2 Give the label new text to display @property (nonatomic, strong) IBOutlet U原创 2013-02-27 15:39:17 · 322 阅读 · 0 评论 -
Action methods vs. normal methods
The difference between an action method and a regular method: Nothing. An action method is really just the same as any other method. The only special thing is the (IBAction) specifier. This allows In原创 2013-02-27 15:47:28 · 384 阅读 · 0 评论 -
AlertView
- (IBAction)showAlert { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hello,World" message:@"This is my first app!"原创 2013-02-26 20:09:33 · 402 阅读 · 0 评论 -
AboutView -- Create the second window in the app
1. create the second window by new file -> objective-C class (subclass of ViewController). then .xib, .h and .m 2. set Action in the first view to trigger the second window - (IBAction)showI原创 2013-02-27 20:54:21 · 331 阅读 · 0 评论 -
AboutView -- Close the second window
1 Set the Action in the second window 2 in .m file, implement the - (IBAction)close method. pp 120 // AboutViewController.m -(IBAction)close { [self.presentingViewController dismiss原创 2013-02-27 21:15:20 · 324 阅读 · 0 评论 -
Loads the local HTML file into the web view in the app
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@原创 2013-02-28 00:22:41 · 640 阅读 · 0 评论 -
Add a simple crossfade
Add a simple crossfade after the Start Over button is pressed, so the transition back to round one won't seem so abrupt. pp146 #import - (IBAction)startOver { CATransition *tr原创 2013-02-28 01:04:35 · 361 阅读 · 0 评论 -
Primitive values and Objects
Dictionaries cannot contain primitive values such as int and BOOL, only objects. The same thing goes for arrays. If you want to put an int or BOOL values into a dictionary or array, you have to conver原创 2013-03-18 06:56:26 · 613 阅读 · 0 评论 -
From NSDate to string
- (void)updateViewDateLabel { NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle:NSDateFormatterMediumStyle]; [formatter setTimeStyle:NSDateForma原创 2013-03-19 16:35:56 · 741 阅读 · 0 评论 -
Generating the random number
You can't really get a computer to generate numbers that are truly random and unpredictable, but we can employ a so-called pseudo-random generator to spit out numbers that at least appear that way.原创 2013-02-27 12:17:21 · 380 阅读 · 0 评论 -
lroundf() and sliders
We use the function lroudf() to round the decimal number to the nearest whole number. - (IBAction)sliderMoved:(UISlider *)slider { currentValue = lroundf(slider.value); } pp62原创 2013-02-27 09:48:38 · 2101 阅读 · 0 评论 -
Properties vs instance variables
Properties and instance variables have a lot in common. In fact, when you use @synthesize to create the property, it is "backed" by an ivar. That means our slider property stores its value in an insta原创 2013-02-27 12:03:04 · 408 阅读 · 0 评论 -
Saving and Loading the Checklist Items
Saving - (NSString *)documentsDirectory { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //asd NSString *documentsDirectory = [pat原创 2013-03-08 06:15:37 · 485 阅读 · 0 评论 -
How does an app work?
On iOS, apps are event-driven, which means that the objects listen for certain events tooccur and then process them. As strange as it may sound, an app spends most of its timedoing... absolutely not转载 2013-02-26 20:35:42 · 399 阅读 · 0 评论 -
UIKit and other frameworks
iOS offers a lot of building blocks in the form of frameworks or "kits". The UIKit framework provides the user interface controls such as buttons, labels and navigation bars. It manages the view contr原创 2013-02-26 20:48:28 · 274 阅读 · 0 评论 -
ViewDidLoad
Do some setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.原创 2013-02-27 10:23:41 · 453 阅读 · 0 评论 -
Point and Pixel
So what is a point? On the iPhone 3GS and earlier models, as well as the corresponding iPod touch models and the iPad 1 and 2(including mini?), one point corresponds to one pixel. That's easy. Pixel原创 2013-02-26 21:01:18 · 667 阅读 · 0 评论 -
Converting the app to landscape
To convert our app from portrait into landscape, we have to do three things: 1 Make the view from BullsEyeViewController.xib landscape instead of portrait. 2 Change one line of code in BullsEyeViewC原创 2013-02-26 23:09:54 · 536 阅读 · 0 评论 -
Properties and Outlets
These three steps are necessary for just about any property you add to the view controller if that property refers to a view in the nib: 1 add @property to the .h file, 2 connect the outlet in Inter原创 2013-02-27 11:47:06 · 295 阅读 · 0 评论 -
Get Application Display Name
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];原创 2014-09-03 09:58:37 · 969 阅读 · 0 评论
分享