2013年3月18日 星期一

homebrew xcode opencv

use homebrew to install opencv

brew install opencv

and in xcode project

add
Header Search Paths: /usr/local/Cellar/opencv/   choose recursive
Library Search Paths: /usr/local/Cellar/opencv/   choose recursive
Other Linker Flags: -lopencv_core -lopencv_highgui -lopencv_imgproc (add other if you want to use other library)


Then you can write your opencv code!

Problem1: OpenCV Unresolved symbols
Ans: switched the compiler used in the XCode (Apple LLVM 4.1) to the LLVM GCC 4.2 and now it works!
http://stackoverflow.com/questions/13461400/opencv-unresolved-symbols-name-mangling-mismatch-xcode
Ans2:Under Build Settings>Apple LLVM compiler 4.1 - Language>C++ Standard Library: Change from libc++ (LLVM ...) to libstdc++ (GNU C++ ...).
http://stackoverflow.com/questions/12770115/linking-libraries-opencv-2-4-2-on-xcode-4-5-1?rq=1

2013年3月12日 星期二

ios iboutlet


今天遇到一个问题困扰了很久。 代码如下:
1
2
3
4
FileOverviewViewController *fileOverviewViewController = [[FileOverviewViewController alloc] initWithNibName:@"FileOverviewView" bundle:nil];
// AAAAA
[self.navigationController pushViewController:fileOverviewViewController animated:YES];
// BBBBBB
如果你有这个Controller中的view里面有IBOutlet的变量,如果你在A的地方进行赋值或者其他操作的话,界面将不会有任何更新,那些IBoutlet变量的值都为NULL, 如果在B处设置就可以正常显示了。
结论: 如果你使用navigation Controller的话, 一定要在push了这个ViewController之后再操作这个ViewController中的IBOutlet变量,否则这个变量会因为不在作用范围内而无法操作。
扩展开来也就是说只有当一个ViewController被载入处于活动状态的时候,这个ViewController中的IBOutlet变量才能正常使用,否则都会因为不在作用范围内而无法正常使用的
http://blog.prosight.me/index.php/2009/10/415


我今天試圖把iboutlet放在view上,
然後在initWithACoder去設定裡面的東西,
發現沒反應因為是null就是這個原因@@

最後就只好在view裡面開一個method,
當viewcontroller的viewdidload時執行此method來做設定。

ios function parameter using block


Example:
- (void)someFunc:(void(^)(void))someBlock;

- ( void )myMethodTakingPredicate: ( BOOL ( ^ )( int ) )predicate

2013年3月2日 星期六

urban airship

Header search path - Ensure that your project’s header search path includes the Airship directory (recursive).

use:
"$(SRCROOT)/Airship/" recursive

add header:
//urban airship
#import "UAirship.h"
#import "UAPush.h"