For iPhone users, when you are viewing a website on Safari and switch the screen orientation from portrait to landscape, you will find that the content of the page will be scaled automatically to fit the screen width. This maybe a nice feature but probably not good for responsive design.
To disable the auto scaling, you can add the following meta on your HTML inside the <head> tag.
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0" />
A drawback is the above meta will disable the user scaling as well. For more information, please refer to the reference link below.
Reference: StackOverflow – How can I disable MobileSafari’s content scalling on orientation change?
Finally i have unlocked the iPhone 4s which Tinyan got it from her uncle about half a year ago. Thanks Steve for letting me know this solution. It unlocks a jailbroken iPhone 4 or iPhone 4s using SAM(Subscriber Artificial Module) which is written by Sam Bingner and it is confirmed by the MuscleNerd of iPhone Dev Team.
You can find the unlock procedures in the following 2 posts.
I tried a few times by following the above steps but no luck. Whenever i connect the iPhone 4s to iTunes in the final step, iTunes always returned that the phone cannot be activated.
Finally, i follow the screencast made by Jeff Benjamin from iDownloadBlog and suddenly the signal bar appears.
Continue reading Unlock iPhone 4s using SAM
The iPhone MAC address could be found in Settings -> General > About -> Wi-Fi Address
Reference: Locating MAC address on iPhone
This is the last iPhone application i wrote when i was working in HKU and it is the most complicated one among the 3 apps since it needs to handle different types of questions like drag n drop and multiple choice… etc
There is a lite version which is free of charge, try it now. But it only has Chinese version. =P Continue reading Math King – My Third Approved iPhone App
The is the my second approved iPhone application which is called Score Marker (Download). As it’s name says, it is for marking the score of every player in a game such as UNO and Mahjong. After the game is ended, you could save the result as a picture in your iPhone so you can share it with your friends about who is the winner and who is the loser. You can even upload the picture to the internet and share it in social networks. Continue reading Score Marker – My Second Approved iPhone App
A few months ago, i have a post talking about adding a return button for UIKeyboardTypeNumberPad.
iPhone – Add the Return Key for UIKeyboardTypeNumberPad
But that only works in iOS SDK <= 3.2M. After i upgrade it to 4.0, that feature was broken.
It is found that the we have add the observer to the UIKeyboardDidShowNotification instead of UIKeyboardWillShowNotification. Moreover, the view prefix is changed from <UIKeyboard to <UIPeripheralHostView. Here comes the code. Continue reading iPhone – Add the Return Key for UIKeyboardTypeNumberPad in iPhone SDK 4
Drawing a circle in UIView is similar to drawing a border which is shown in the previous post.
iPhone – UIView with Border
Please follow the above example and modify the UIViewWithBorder.m as below. Continue reading iPhone – Draw a Circle in UIView
The border of the view could be drawn in the drawRect method in the view. Here is an example.
1. Create a UIView subclass (ex. UIViewWithBorder)
2. Construct the drawRect method In the UIViewWithBorder.m as follow Continue reading iPhone – UIView with Border
We can add an open URL action in iPhone application by the following line of code.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://ykyuen.wordpress.com"]];
please note that it will close the application and open the URL in browser.
And if you want to have a direct link to Apple appstore, you can get the URL from iTunes Link Maker.
It is very simple to implement touch events in iPhone application. The touch event is defined in the UIResponder which is the super class UIView. So for any UI controls, simply add the following piece of code to handle the touch events. Continue reading iPhone – Implement a Simple Touch Event