Tuesday, January 13, 2009

Qt + visual studio 2005

I am following this article to setup Qt 4.4.3 on windows and integrate it with VS 2005.
The article is in Chinese, but the later VS 2005 configuration part should be easy to follow with all the snapshots it provides. 
For the Qt installation part, you can search "Qt visual studio 2005" and follow the video.

Some tips to mention:
1. After Qt installation, compilation is still needed. 

2. You should use "visual studio 2005 command prompt" (instead of windows cmd) to key in the commands.

3. It takes long for "configure" and even longer for "nmake"(2-3 hrs). 

4. When installing Qt Visual Studio Integration, you may receive warning message saying "cannot find Qt package" or "vs 2005 service pack 1 is not installed". 

For the first one, just ignore it. I have tried a simple example. So far so good.
For the second one, you should update your vs2005 (install service pack 1) first. And check your disk space for it, MS products do eat hardware.


Wednesday, December 31, 2008

some useful classes hidden in iPhone SDK 2.2

I just found a useful view called "UICalloutView". It is a cool pop-up window suitable for information briefing or hints.

What is more interesting is that it is nowhere to be found in the iPhone SDK 2.2 document. I can only find it in SDK 1.0 document, but it still can be used under iPhone SDK 2.2.

Although I don't quite understand how it works, just declare the class and its methods where you want to add this view , you can use it right away.

I found this view and the example code in xxx under category "C08 - Controls" => example 11a. 

I forgot the source for xxx and will check it later. It offers really good examples for iphone development and it is totally code-based! I must admit I am still awkward in using graphical interface and makes mistakes from time to time. Codes makes me morecomfortable lol.

Tuesday, December 30, 2008

iphone : how to differentiate single & multiple taps

Aim: 

Make single tapping and double tapping on iphone trigger different event handling functions respectively.

Difficulty:  

When you double tap, the first tap will be recognized as single tapping and trigger the single tapping handling function. 
After that, the second tapping will be recognized as double tapping and trigger the double tapping handling function.

So if you rewrite touchesEnd as follows:

- (void) touchesEnd: (NSSet *) touches withEvent:(UIEvent *) event
{
UITouch *touch = [touches anyObject];

switch ([touch tapCount])
{
case 1:
[self singleTapHandlingFunction];
break;
case 2:
[self doubleTapHandlingFunction];
break;
}

}

If you double tap, both singleTapHandlingFunction and doubleTapHandlingFunction are triggered, which in most cases not desirable.

How to solve:
"iPhone OS Programming Guide 2.0"
 page 145 has provided a solution:

1. In touchesEnded:withEvent:, when the tap count is one, the responder object sends itself a performSelector:withObject:afterDelay: message. The selector identifies another method implemented by the responder to handle the single-tap gesture; the object for the second parameter is the related UITouch object; the delay is some reasonable interval between a single- and a double-tap gesture.

2. In touchesBegan:withEvent:, if the tap count is two, the responder object cancels the pending delayed-perform invocation by sending itself a CancelPreviousPerformRequestsWithTarget: message. If the tap count is not two, the method identified by the selector in the previous step for single-tap gestures is invoked after the delay.

3. In touchesEnded:withEvent:, if the tap count is two, the responder performs the actions necessary for handling double-tap gestures.

An example code is provided in the following thread: