Aug 18
쓸 일이 있어서 쓰고 포스팅합니다.
투명 View위에 글자나 버튼은 투명하지 않게 하기는, setAlpha를 overriding하는 방법도 있겠지만, 간단하게
* BaseView를 투명한 View라고 하고, 글자나 버튼을 sub views라고 하면
1. Base View는 alpha는 1.0로하고 [UIColore clearColor]로 완전 투명하게 하고
2. Base View와 크기가 같은 View를 원하는 색으로 backgroundColor로하고 alpha (0.5 등)을 주고 Base View에 addSubview 하고
3. 버튼이나 글자의 sub view들은 원하는 (투명하지 않게 alpha는 1.0이겠죠?) Base View에 addSubview합니다.
** View들은 상위 view의 alpha에 영향을 받기 때문에 이런 짓을 해야겠죠?
Ref: iPhone SDK: Non-transparent subviews in transparent view
Tagged with: alpha • iphone • subview • transparent • uiview • 아이폰 • 애플
Aug 17
네.. 제목처럼 해주는 것을 예제로 만들어서 첨부해봤습니다.
greyscale은 image processing의 한 예를 보여준 것이고, UIImage에서 pixcel 정보를 가져와 bitmpa으로 이미지 처리를 하고 다시 UIImage를 반환해주는게 의미를 더 가질 것입니다.
UIImage에서 bitmap을 만들 때, colorspace나 alpha 등의 bitmpa 정보 설정에 삽질을 좀 해서 정리해서 올려봅니다.
AloImageProcessing가 UIImge를 받아서 greysacale을 하고 UIImage를 반환해주는 녀석입니다.
outputImageView.image = [[[imageProcessing setImage:sourceImageView.image] greyscale] image];
-_-;; 요즘 손담비님이 좋아져서 ㅋㅋㅋ 아래와 같이
Tagged with: alpha • bitmpa • colorspace • greysacle • image processing • iphone • iphone_dev • UIImage • 아이폰 • 애플
Jul 28
NSOperation, Notification, NSCondtion 등의 순수하게 의도된 방법을 쓰면 된다.
하지만 한 번 만들어진 앱에서 UI (때론 더러운 플로우가 엉켜있는)가 덕지 덕지 붙은 상황에서
Main run loop에서 asyn job을 기다리는 것은 여간 쉬운 일이 아닌다.
ㅎㅎ 하지만 오늘 구글 리더를 읽다 아주 나이스한 뽀록 (사실 뽀록은 아니고 API를 잘 찾아 이해해서 쓴 것이니) 팁 발견!
아주 예쁘게 기다려준다. 흑흑흑.
int i = 0;
while (i < 10)
{
// This executes another run loop.
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
i++;
}
Ref: http://blog.sallarp.com/iphone-ipad-wait-for-asynchronous-nsrunloop-task-to-complete/
runMode:beforeDate:
Runs the loop once, blocking for input in the specified mode until a given date.
- (BOOL)runMode:(NSString *)mode beforeDate:(NSDate *)limitDate
Parameters
mode
The mode in which to run. You may specify custom modes or use one of the modes listed in “Run Loop Modes.”
limitDate
The date until which to block.
Return Value
YES if the run loop ran and processed an input source or if the specified timeout value was reached; otherwise, NO if the run loop could not be started.
Discussion
If no input sources or timers are attached to the run loop, this method exits immediately and returns NO; otherwise, it returns after either the first input source is processed or limitDate is reached. Manually removing all known input sources and timers from the run loop does not guarantee that the run loop will exit immediately. Mac OS X may install and remove additional input sources as needed to process requests targeted at the receiver’s thread. Those sources could therefore prevent the run loop from exiting
Tagged with: apple • iphone • iphone_dev • 애플
Jul 17
AccelerometerGraph
http://developer.apple.com/iphone/library/samplecode/AccelerometerGraph/Introduction/Intro.html
예제가 업데이트 되었더군요.. Filter가 들어가서 아래 그림처럼 값이 보정되어집니다.
워낙 예전에 보고 오랜만에 다시 봐서 Filter들어 간 것을 이제 봤네요 ㅋㅋ

Tagged with: accelerometer • iphone • iphone_dev • 가속기 • 아이폰 • 애플