- 博客(22)
- 收藏
- 关注
转载 data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *
2013-02-28 23:15:34 419
原创 Checklists
This is the second appHow it looks like pp2 : a to-do listThe app lets you organise to-do items into lists and then check off these items once you're done with them. You can set a reminder on a to
2013-02-28 22:19:40 463
转载 Communicate between objects
By MatthijsWhen you have two objects A and B, says two view controllers, that you want to make talk to each other, you can choose from the following options:NSNotifiationCenter.This is anonymo
2013-02-28 20:30:05 410
原创 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 351
原创 Loads the local HTML file into the web view in the app
- (void)viewDidLoad{ [superviewDidLoad]; // Do any additional setup after loading the view from its nib. NSString *htmlFile = [[NSBundlemainBundle] pathForResource:@
2013-02-28 00:22:41 622
原创 AboutView -- Close the second window
1 Set the Action in the second window2 in .m file, implement the - (IBAction)close method.pp 120// AboutViewController.m-(IBAction)close{ [self.presentingViewControllerdismiss
2013-02-27 21:15:20 309
原创 AboutView -- Create the second window in the app
1. create the second window by new file -> objective-C class (subclass ofViewController). then .xib, .h and .m2. set Action in the first view to trigger the second window - (IBAction)showI
2013-02-27 20:54:21 321
原创 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 372
原创 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) IBOutletU
2013-02-27 15:39:17 310
原创 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 371
原创 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 397
原创 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 281
原创 ViewDidLoad
Do some setup after loading the view, typically from a nib.- (void)viewDidLoad{ [superviewDidLoad];// Do any additional setup after loading the view, typically from a nib.
2013-02-27 10:23:41 443
原创 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 2085
原创 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 525
原创 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 654
原创 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 266
转载 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 385
原创 AlertView
- (IBAction)showAlert{ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hello,World" message:@"This is my first app!"
2013-02-26 20:09:33 389
原创 Bull's Eye
If you have the imagination and perseverance there is no limit to what you can make these cool little devices do.pp16 start the first app Bull's EyeButtonpp27Alert View popuppp28ViewCo
2013-02-26 19:59:55 654
原创 Miscellanies of iOS 3) Managing Memory with ARC
pp101 Not just copy and paste anymore... For the usage of review1. All Objective-C Objects are stored in a part of memory called the heap. When we send an alloc message to a class,
2013-02-03 10:19:07 378
原创 Miscellanies of iOS 2) Random Possessions
Chapter 2 Objective C The Big Nerd Ranch Guide1. But there is an important difference between a structure in C and a class in Objective-C: a class has methods. A method is similar t
2013-02-01 01:19:05 422
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人