Wednesday, September 11, 2013

iOS 7's Sprite Kit

Apple unveiled iOS 7 in Jun 2013, and recently confirmed that the new iOS 7 is to be staged on 18 Sep 2013. I am not a big fan of iOS7 flat design, but as an iOS developer I love the new OS so much because it gives developers a great tool SpriteKit to write games. Among those new features or APIs of iOS 7, the SpriteKit shall be top one.

Before Sprite Kit, writing Games for mobile needs strong knowledge in OpenGL ES, or build on top of third party game engines, e.g. Cocos2D, Unity, which handles low level OpenGL stuff for developers. It's easier to do games with third party engines, but there is still a substantial hurdle for a normal iOS App developer to write games. However, games are the most profitable category on the App Store, and iOS users love games, people love games. This is why the new Sprite Kit are so welcomed by iOS developers.

I had some experience with Cocos2d, it has a node based objects system together with Box2d and Chipmunk as the physics engine, and CocosDenshion as the sound engine, with all together developers can develop great games, and majority of 2D games on the App Store today are built with Cocos2D.

Apple's SpriteKit embraces a similar nodes system, actions, physics, and sound, all together in one framework, . I have tried some codes with it and found it is insanely simple to use. The framework is shared by Mac OS and iOS, integrated deeply with Cocoa and UIKit. That means games developed with SpriteKit can reuse/share a lot of code between both platforms. Apple has made a great documentation for the framework called 'Sprite Kit Programming Guide' and Apple is also very kind to provided a 'code explained' sample project called 'Adventure'. The sample project is coded for both Cocoa and iOS, and uses most of the features of the SpriteKit.framework. Developers can start to build games after finish learning the sample project.

screen capture of Adventure

The new Xcode 5 has also embedded some cool function to support SpriteKit. I have noticed that it has a built-in particle editor that is so simple and easy to use. Changes can be previewed at real time. Besides, the new Xcode also handles atlases for developers. Developers just need to put all images in a folder with special name, and the XCode will automatically create atlases for them during compile. Specially, to use any sprite from Altas, developers don't need to write any special code, just use it as a standalone image, call it with the name of the image. People used to edit particles and make atlases with third party tools when using Cocos2D.

At this point, I am so excited about this new framework and so looking forward to making games. I think Apple is ambitious for Games, haven't mentioning that there is another new important Game related framework 'GameController.framework' came with iOS 7. GameController is the framework to talk to physical Game Controllers. Just look at the picture below you will get all what I am talking about. The whole thing together will bring gamer's experience to another level up.

Friday, April 12, 2013

UIWebView + javascript

Javascript is a very powerful tool for a web developer. iOS SDK's UIWebView can display a webpage or a html string. Most of time, developers just use the webpage for displaying. Actually, the SDK provides a little but powerful API for us to interact with the Web using javascript. It is :


- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
 

From this method, we can pass in a string of javascript, and get return as as string. I am going to demonstrate some of the typical uses of this method.

The HTML code

the html code looks as following. style, div,p, script, those are typical elements that an usual html page has.

 
<style>
    #pageWrap{
        color:blue;
        font-size: 15px;
    }
</style>

<div id="pageWrap">
    <h2 id="demo-title">Demo Title</h2>
    <p>Demo text, just some dummy text here. Demo text, just some dummy text here. 
    Demo text, just some dummy text here. Demo text, just some dummy text here. 
    Demo text, just some dummy text here. Demo text, just some dummy text here.
     Demo text, just some dummy text here. Demo text, just some dummy text here. 
     Demo text, just some dummy text here. Demo text, just some dummy text here. 
     Demo text, just some dummy text here. </p>
</div>
<script>
    function testing(){
        alert('OK for Testing');
    }
    
    function getSum(x){
        return x+100;
    }
</script>
 
 

The Objective-C code

The objective-c code looks as following. we can see that the html is loaded from a local file.

  1. fontSizeChange: is the method to change the page text size adjust, triggered by the UISlider. We just passed a string of javascript, and not interested with the return.
  2. showAlert: is the method triggered by the UIButton with title 'Show Alert'. Here the js string we passed in is actually a function call. The Alert title is related to the what we gave for baseURL in [theWeb loadHTMLString:theS baseURL:base];
  3. getjsFunctionReturn: is the method triggered by the UIButton with title 'Get Return'. In this methods, we are calling a js function with a input integer 3, get back 103.

  
- (void)viewDidLoad
{
    [super viewDidLoad];
    scale=100;
    currentFontLbl.text=[NSString stringWithFormat:@"%d%%",scale];
    NSString * path=[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
    NSString * theS=[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
    NSURL *base=[NSURL URLWithString:@"www.ios-local.com"];
    [theWeb loadHTMLString:theS baseURL:base];
}

- (void) webViewDidFinishLoad:(UIWebView *)webView{
    NSLog(@"webviewDidFinished");
}

- (IBAction)fontSizeChange:(UISlider*)sender{
    currentFontLbl.text=[NSString stringWithFormat:@"%0.f%%",sender.value];
    NSString * jsString=[NSString stringWithFormat:@"document.getElementById('pageWrap').style.webkitTextSizeAdjust='%@';", currentFontLbl.text];
   [theWeb stringByEvaluatingJavaScriptFromString:jsString];
}

- (IBAction)showAlert:(id)sender{
    NSString * jsString=@"testing();";
   [theWeb stringByEvaluatingJavaScriptFromString:jsString];
}

- (IBAction)getjsFunctionReturn:(id)sender{
    NSString * jsString=@"getSum(3);";
    NSString * returnS=[theWeb stringByEvaluatingJavaScriptFromString:jsString];
    NSLog(@"%@",returnS);
}
  

 

baseURL=@"www.ios-local.com"

baseURL=@"http://www.ios-local.com"

Source code can be downloaded at: Link

Sunday, March 24, 2013

Some Tips for using Apple's Devices

iOS: Double click Home Button

When you double click the physical 'Home' Button of your iPhone, the background 'running/idle' Apps will be brought up. Then, you long press any of those small icons; you will see little 'close' buttons. Most of time, you will surprisingly see a lot of 'running/idle' Apps here. Close them to free up some memory for the forefront App. There is another tip here. It supports multiple fingers touch, which means you can use 3-4 fingers to tap this area to speed up closing them.

iOS: Lock Orientation Change

Same as above, double click the physical 'Home' Button of your iPhone, scroll to the left until you see the following. Click the left most icon, which is the lock orientation button.

iOS: Quick Language Switch

Most of people just know click and change language. Change one by one click. When you press and hold, you will see the following. Hold and move your finger to the language you want and release. Doing so, you've got the language selected.

Mac: Resize Bar Icons

It is really difficult to find, if you've never been told. Look at the red highlighted spot. You know what to do. Try it!

Tuesday, December 4, 2012

iOS 6's Social Network integration

First thing I want to say: Really appreciate Apple for putting efforts to embed the social sharing functions into the iOS SDK 6.0. You know what, thousands of lines of code I used to do social sharing can be totally deleted now. Wow! It can be just less than 10 lines of code now.

To bring out the Sharing Panel above, we just need to write the code:

- (IBAction) shareButtonClicked:(id)sender{
    NSString *textToShare = @"Hello World!";
    UIImage *imageToShare = [UIImage imageNamed:@"ss.jpg"];
    NSArray *activityItems = @[textToShare, imageToShare];
    UIActivityViewController *activityVC =
    [[UIActivityViewController alloc] initWithActivityItems:activityItems
                                      applicationActivities:nil];
    [self presentViewController:activityVC animated:YES completion:nil];
}

UIActivityViewController is under UIKit, so we don't need to include any framework. What we did here was to supply the activitiyVC with a string and an image, and leave all the rest to UIActivityViewController.

Sometimes, we may not provide the sharing panel to user. If we just want to present user the facebook sharing, then we can simply user the following code:

- (IBAction)facebookShare:(id)sender{
    // need include social.framework
    SLComposeViewController *facebookPostVC=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    // You can have other servicetypes for Weibo, Twitter.

    [facebookPostVC setInitialText:@"Hello World!"];
    [facebookPostVC addImage:[UIImage imageNamed:@"ss.jpg"]];
    [self presentViewController:facebookPostVC animated:YES completion:nil];

}

Very similarly, very simple codes...You will get something as following directly. As I comment in the code, we can do the same way for Twitter and Weibo. To use SLComposeViewController, we need to include Social.framework

Very simple right. I love this. However, we have to realize the drawbacks. Good things don't come out without cost... Doing this way, we have no more deep link to Facebook, no need to create App on developers.facebook. So people won't see the feed comes from your App.

Sunday, November 4, 2012

UITextField with Input from UIPickerView

Sometimes, we need an UITextField whose input is picking from an array of strings. People may popup an UIPickerView from an UIActionSheet/UIPopoverController, but it is easier to use UITextField's inputView to do this. Doing this way is more intuitive and more OOP. I would like to achieve something shown below.

To do this, I created a subclass of UITextField, called PickerTextField

In the header file, we can see it is a direct subclass from UITextField. I created some varibles: 1. sourceStringsArray to hold the array of strings to select from; 2. picker to be the inputView of the TextView. 3. pickedIndex to indicated the selected index.

pickedIndex is also declared as a property, used to be an API from other class to access it. You may wondering, how can we access the text from outside? Super easy. my_sub_class.text will give you the text, just like a normal UITextField.

The method:'{setDataSource: andPlaceHolder:}' is an important method for us to set the sourceStringsArray and the textfield's placeholder property.

First two methods are initialization, they won't be called at the same time. Please refer to the comment in the code. Also note '[super setDelegate:self];', which direct the UITextField's delegate to this subclass itself.

'{setDataSource: andPlaceHolder:}' as mentioned earlier, used to assign sourceStringsArray. It has to be called before using it. Besides, we also setup the picker here, and assign the UITextField's inputView to the picker.

 if (self.pickedIndex!=-1) {
        [self setText:[sourceStringsArray objectAtIndex:self.pickedIndex]];
    }
If you want pre-select certain element for the PickerTextField, you call assign a pickedIndex before calling the method.

The remaining code is quite straight forward. UIPickerView's delegate methods. We change the pickedIndex and the text when the picker's selection changes. The following class is only to serve as the mid-object to forward UITextFieldDelegate methods to the PickerTextField. We pre-select first element, if pickerIndex is not assigned with any value and remains -1. I tried to simply use'[super setDelegate:self]' in PickerTextField, but that will lead to infinite loop, end up have to create the PickerTextFieldHandler class to forward.

You can also download the code from git.

Friday, July 27, 2012

Size of iPhone's Photo


Device Photo Size Photo's w:d Ratio Instagram High Resolution Instagram Low Resolution
iPhone 4S 2448 x 3264 3:4 2048 x 2048 612 x 612
iPhone 4 1936 x 2592 3:4 1936 x 1936 612 x 612
iPhone 3GS 1536 x 2048 3:4 1536 x 1536 612 x 612
Recently, I need to do some research about iPhone's photoing functions. Have some figures consolidated here to share with you and also for referring back by myself.

We all know iPhone's screen size is 320 x 480 (640 x 960 for retina), and the ratio is 2:3. Physical screen's w:h ratio 2:3 and photo's w:h ratio 3:4 is close to each other, but the difference is there. If we compare these two ratios, we will find that the photo has more width. People may seldom realize the difference because Apple has done intelligent handling when you are taking the photo with the "Camera App" and when you are viewing the photo with the "Photos App".

When you use the "Camera App" to take a photo, the preview live screen has a width=320px and a height=480px-53px (the camera controls is around 53px) =427px;320:427 is about the same as 3:4. So the preview screen and the photo's w:h ratio is the same, you get exactly what you see in the live preview captured in the photo without any distortion.



Let's see what happens when you open the photo from the "Photos App". Most likely you enter the full-screen mode. Oops, how come the photo with w:d=3:4 just fits into the iPhone's screen with w:d=2:3? The secret is it doesn't really fit. When you zoom out, you will find out the full-screen photo hides small parts at left and right while fits in the height only.

When talking about iPhone photo, have to mention Instagram. Instagram is a great app with simplicity, power, fun. Instagram's photos are all square shape, no need to worry about the ratios. All images are cropped into square before processing.

Thursday, May 31, 2012

Map of iOS SDK Frameworks

I recently saw a map of iOS SDK Frameworks, and was surprised by the author's mindful effort to create it. This map should have come from Apple's developer site or xCode, but it never happened.

I problems when develop an App with lastest iOS SDK but support old iOS (e.g. base SDK: iOS 5.1,  Deployment Target: iOS4.0). When I create functions whose API is only available for iOS 5.0+, that will be a problem if I dont have this map in mind.  With the map in mind, I will be aware that I need to do some API checking before using. 

Class cls = NSClassFromString (@"UIDocument");
if (cls) {
    // Create an instance of the class and use it.
} else {
    // Alternate code path to follow when the
    // class is not available.
}
As an iOS developer, this map also help me to evaluate my skills by checking whether I am familiar with all the listing frameworks.



 the map is created by 德鲁伊@cocoachina.com(Ref)

Friday, December 23, 2011

Difference between iCloud and Dropbox

iCloud was just launched by Apple for about two months ago with iOS5, but a lot of criticisms about it already.

I think most of people complaining iCloud because they couldn’t use iCloud as Dropbox. Dropbox is a mature cloud service, which people can save and access files from a computer, iOS, Android, Blackberry… It is more like a skydrive, and you can save any kind of files into Dropbox. On the other hand, iCloud is very similar to other Apple’s software, e.g. iTunes, and App Store, which serves Apple’s hardware, e.g, iPhone, iPod, iPad, Mac. All of Apple’s software and hardware help each other, and all together they form a unique strong empire of “Apple”.

With iCloud, iOS users can backup, restore and even update to newer iOS by air, “Cut the Cable”. If user buys music or app from one Apple device, all the purchases can be installed into user’s other Apple devices from iCloud. It is really convenient. Another good selling point of iCloud, is about document or data synchronizing, for instance Mail, iCal, iWork, PhotoStreams. Have to emphasize iWork here because most of professionals care about it. You can work on your Pages, Numbers, and Keynotes files with any iOS or mac OS devices, and all the updates from one device will be automatically updated to other devices.

iCloud has brought us a lot of convenience and efficiency improvements. However, I hope it can be more open.

1. That would be great if they can build up a client-end application for computer, where user can interact with their iCloud files more easily instead of going to iCloud.com and keying Apple ID and password every time.
2. That would be great if they can allow my App “Save to Cloud” to appear in their iCloud.com or the future iCloud Application that I talked in point 1. “Save to Cloud” is mainly helping user put some documents (Any kind of documents) into iCloud and access them with any iOS devices. 5GB free space, user can put a lot of stuff there. I was thinking Apple might do it in the way of Dropbox that user can freely use it as a skydrive from different OS. I have recently realized that this is not possible because it is not Apple anymore if they do so. Apple is closed but open. Closed, means they won’t let Android or Window 7 to access iCloud or let Microsoft Office or other non-Apple’s Application to apprear in iCloud.com. While open, means they open up iCloud API to iOS and Mac developers. Developer can access iCloud within their application

To sum up, Apple’s iCloud is doing good in Apple’s way. Dropbox is unbeatable as a skydrive. However, iCloud is so young, and Apple is hiring a lot of talents for iCloud business, so let’s waiting for something surprising to happen.

So, I have decided to work hard to give “Save to Cloud” users more convenience during interacting with iCloud documents, I will develop a separate App for Mac. Some news saying Apple may open iCloud API to Windows PC. Well. If that is true, I will develop an application for Windows.

Sunday, November 20, 2011

My App (2): Save to Cloud


Please be noted that this App was removed from App Store in May, 2012.
Reason: The App's concept of using iCloud as a cloud disk to save files is not aligned with Apple's perception. Apologize for any inconvenience caused.

This is an App created based on iOS5's iCloud Technology. (Demo)

Main functions: 
1. Save Files to iCloud and automatically shares between different iOS devices.
2. Save Accounts(username/password) to iCloud and automatically shares between different iOS devices.


User Tips: 
On Mac, you can interact (drag files in, delete files, edit files, create folders...)with your iCloud documents on a Mac at path: /Users/Your_User_Name/Library/Mobile Documents/MUPXVM5Q6W~com~creiapp~fileincloud/Documents

Second Tab: Files
Do all the things with file. e.g. Move, Copy, Rename, send as Email attachment, Send local file to iCould, download iCloud files to local, share the file iCloud link to friend for them to download
You can even open unzip a .zip file with this App.


Common ways to add files to the "Save to Cloud":
-->
  1.  connect iOS device to iTunes, drag and drop via iTunes Files sharing.
  2.  open email attachment from "Mail" App.
  3.  open file from any other App that has an option for "Open in...".
  4.  upload image/video from Album via “Loader”


Third Tab: Accounts This tab was developed for people who don't wanna memorize dozens of website logins accounts/passwords. Save the account information in iCloud, you can view it in any iOS device with your iCloud ID set up. 

Strongly suggested you set an App Passcode if you want to save any information here. With App passcode, people wont be able to read your accounts information even they steal your device and jailbreak it. The reason is your account information is secured by complex encryption. 
Have to mention that, the Passcode login for "Save to Cloud" is special because people wont be able to figure out your passcode from your fingers movement during login. The number pad is generated randomly every time.


Some screenshot:




I will be glad to hear your comments after using the App. Thank you very much.





Sunday, August 14, 2011

Push Notification iOS Side Programming

Push Notification (also called Remote Notification) is a powerful free function provided by Apple. App can use it to push promotions or other tailor-made messages to App users.

iOS side code is simple, most of time within 200 lines. However, the logic part is a little bit difficult if you want to write an "intelligent" handler when push message comes, taking consideration of the following three scenarios:
  1. App is not running. 
  2. App is running at the background.
  3. App is running at the forefront.
Here, I am going to share some of the iOS side code for "Register for Push Notification" and "Handling of Push Notification".

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

        //////////Your App launch Setups
        //////////Your App launch Setups
        //////////Your App launch Setups
        [self.window makeKeyAndVisible];
//for receiving push notification when the App is not running.
if (launchOptions!=nil) {
if ([launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]!=nil) {
NSDictionary * userInfo=[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
//this userInfo actually contains information about the received Push notification, so write some code about it and do handling about it here. 
}
}
    return YES;

}


-(void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
//send the token to your server here
//send the token to your server here
//send the token to your server here
}

Please take a look at the above code.
First line is to Register for Push Notification, and second line is to clear BadgeNumber if there is any.

Let's go to next function first,
-(void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken.





This function is called when the App receive the "token" from Apple, so you'd write some code to send this code to your server (Better hash it first). With this token, your server will be able to send Push Notification to the user with this "token".

Move back to function (didFinishLaunchingWithOptions), near there end the few lines of code is actually handler for scenario 1: App is not running. 

Handler for scenario 2 & 3 will be handled by the following function, basically it is the place you can capture the message (userInfo) for the Push Notification. In this example, I use an AlertView to display the Push message for scenario 3, which looks intuitive. Then, any further handling with be written within the AlertViewDelegate methods.

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"Got Notification%@",userInfo);
if ( application.applicationState == UIApplicationStateActive ){
// app was already at the forefront: Scenario 3
if ([[userInfo objectForKey:@"aps"] objectForKey:@"alert"]) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
message:[NSString stringWithFormat:@"%@",[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]  delegate:self
  cancelButtonTitle:@"Cancel"
  otherButtonTitles:@"View", nil];
[alertView show];
[alertView release];
}
}
else// app was just brought from background to forefront: Scenario 2
{
//Write your code here to handle your Push Notification
}
}


Hope this helps some people. It is not very in detail, but the structure is there. Thank you.







Monday, August 8, 2011

My App (1): Vcard Backup

VCard Backup

Expert on iPhone's Address Book

Main functions of this App are as following:

1. Import VCF contacts from your old mobile device (e.g. Nokia, Android) to iPhone. Just a few button clicks to BULK_import all your contacts, as long as they are standard VCFs. So this app helps reduce a lot of hurdles for people just switching from other smartphone to iPhone.
2. Export your current iPhone Address Book contacts as VCFs, and save them in your computer for usage of other platform or just as a reliable way to backup your contacts. To most people, contact list within the phone is the most important information that they are afraid to lose. So this app will be their good choice: You Can See The VCards.
3. Backup and Restore Address book (2nd Tab). All the data produced within the 2nd Tab is stored within the App. User can use this as a convenient way of backup and restore, but be careful that the saved data will be lost when the App is uninstalled.

Here are some step guidelines and screen captures for this App.

A: Import

  1. Connect your iPhone with your computer.
  2. Add all the VCFs to the App "VCard Backup" via iTunes' File Sharing.
  3. Open the App in your iPhone, and hit Refresh button. You should see total number of VCFs detected by the App.
  4. Hit "Import to Address Book".
  5. That's it. All the contacts are added to your Address Book.

B: Export

  1. For iOS 6, please turn off Contacts to access your Facebook Contacts, as shown below.
  2. Connect your iPhone with your computer.
  3. Open the App "VCard Backup".
  4. Hit "Export All Contacts".
  5. Save the folder "Export" to your local directory via iTunes' File Sharing.

C:Backup & Restore

  1. Click "Backup Address Book".
  2. Click "Restore from Backup" to restore directly within the App. OR
  3. Click "Email".
  4. Open the Attachment (Backup.vcf) from Mail, you will be able to add all the contacts to address book of any iOS device.
Please leave me a comment here if you have any improvement suggestions or find any Bugs of the App. Thank you.

Tuesday, August 2, 2011

How to add UITextField to UIAlertView from XIB

Today, I am going to share how to add UITextFields to UIAlertView from XIB. 
UITextFields can be added through coding, but I prefer draw it in a small view from XIB because it is more convenient and visualizable. In the following example, I will add 3 UITextFields and 4 UILabels in the small view.

1. Create a view_controller and add the customized small view(named AlertXIB in the picture, while named "changePasswordView" in the code) parallel to the main view of the view_controller. Add certain number of UILabels and/or UITextfields in the small view. As shown in the picture:






























2. Add the view into the view_controller' main view on a button click.

-(IBAction)buttonClicked:(UIButton*) button {
//If I don't add this _fakeTextField, my own textfields won't be able to detect inputs from keyboard, another good thing is that the alertview will be automatically moved up a bit.
UITextField * _fakeTextField=[[UITextField alloc] initWithFrame:CGRectMake(12, 3, 200, 30)];
_fakeTextField.backgroundColor=[UIColor clearColor];
_fakeTextField.userInteractionEnabled=NO;

UIAlertView *_myAlertView = [[UIAlertView alloc] initWithTitle:nil message:@"\n\n\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];
changePasswordView.frame=CGRectMake(12, 3, changePasswordView.frame.size.width, changePasswordView.frame.size.height);
newPassword.text=@"";
oldPassword.text=@"";
confirmPassword.text=@"";
[_myAlertView addSubview:_fakeTextField];
[_fakeTextField release];
[_myAlertView addSubview:changePasswordView];
[_myAlertView show];
[_myAlertView release];
}

A few things to explain here:
1). The message of the UIAlertView, I use several newline characters, because the message will be determine the size of the UIAlertView.

2). A "_fakeTextField" is also added, reason is what i explained in the comment. You can play around with it. For all the UITextfields "newPassword, oldPassword, confirmPassword", you can configure their UITextFieldDelegate via XIB or code. 

3). delegate of the UIAlertView is set to self (the view_controller), so you can handle further processing when user clicks button on the UIAlertView.

#pragma mark -
#pragma mark UIAlertViewDelegate

-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==0) {
NSLog(@"button at index 0, cancel and doing nothing");
} else {
//Change password code here
NSLog(@"button at index 1");
}
}



3. So when the button click method (buttonClicked:) is called, the view will look like this. The UILabel text in the UIAlertView is in black color is just for demo, while you can change it to any color or size you want.




Tuesday, July 19, 2011

About me

Hello,

I am first time here blogging in Blogger. I am currently an iOS App Developer. Actually, I just started iOS programming about half an year ago, but I have already fallen in love with it.

I will use this blogger as a base to support all my iApps. Besides,I will share some of my developing experience from time to time.