http://myriky.net/tc/87
예전에 요런 글을 썼던 적이 있습죠..

이게 09년 4월 글이네요.. 1년이란 시간이 지나면서 아이퐁 SDK도 많이 변했군요..
그래서 제가 널리 세상을 이롭게 하자는 취지로... -_- 이미지 뷰어를 만들어 봤습니다.

작동은 이렇게 하네요~



파일은 네개로 구성되어 있구요.
MRImageViewController.h .m // MRScrollView.h .m 이 있습니다

사용자 삽입 이미지

뷰어 호출은 다음처럼 하시면 됩니다.

MRImageViewController *_imageView = [[MRImageViewController alloc] initWithTitle:title withCounts:maxCount withPage:startPage];

발로 만든 소스라서.. 그냥 대충 쓰시면 되겠습니다.

다운로드받기

Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2010/07/12 12:04 2010/07/12 12:04
잠깐 iAd 이야기~

회사에서 개발했던 어플리케이션에다가 iAd를 달고, 업데이트를 했다.

어라... iAd 배너 View가 붙어야 할 자리에.. 그냥 덩그러니 빈 화면만 생기네??
그래서 부랴부랴 'iPhone Developer News' RSS를 확인 해 봤더니 이런 피드가 있더라..

사용자 삽입 이미지

'For developers outside of North America, iAd will be rolled out in a few months.'

퓨 먼쓰란다.... 북미시장을 제외하고 나머지 시장은 아직 iAd가 서비스 되지 않는댄다..
아마 광고타겟이 다르기 때문이 아닐까.. 생각이든다

그래서 우리 아시아권 개발자들은..
iAd를 request했지만 거절됐을 때 이벤트를 만들어 줘야되는데
(iAd 영역의 공간을 원래의 컨텐츠가 가져가게 하던가.. 말이지)

http://developer.apple.com/videos/wwdc/2010/
올해 개최되었던 WWDC 페이지를 가면 iAd라던가 멀티태스킹에 관련된 키노트들이 있으니 참고를 하면된다.

그 키노트를 바탕으로 만들어 뒀던 예제는 요렇게 생겼는데요.. 한번 보시죠

- (void)moveBannerViewOffScreen {
    // iAD영역을 없애고 컨텐츠 크기를 늘리는 메소드
    CGRect originalWebViewFrame = _webView.frame;
    CGFloat newWebViewHeight = 416; // self.view.frame.size.height 와 같이 self.view가 되었던, tableview가 되었던 원하는 높이
    CGRect newWebViewFrame = originalWebViewFrame;
    newWebViewFrame.size.height = newWebViewHeight;
   
    CGRect newBannerFrame = _iADView.frame;
    newBannerFrame.origin.y = newWebViewHeight;
   
    _webView.frame = newWebViewFrame;
    _iADView.frame = newBannerFrame;
}


- (void)moveBannerViewOnScreen {
    //iAD가 impression되었을 때 컨텐츠의 일부영역을 잘라서 iAd에게 할당해주는 메소드
    CGRect newBannerFrame = _iADView.frame;
    newBannerFrame.origin.y = 416 - newBannerFrame.size.height; // iAd의 시작위치를 정해주면 됨
   
    CGRect originalWebViewFrame = _webView.frame;
    CGFloat newWebViewHeight = 416 - newBannerFrame.size.height;
    CGRect newWebViewFrame = originalWebViewFrame;
    newWebViewFrame.size.height = newWebViewHeight;
   
    [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
    _webView.frame = newWebViewFrame;
    _iADView.frame = newBannerFrame;
    [UIView commitAnimations];
   
}


- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    [self moveBannerViewOnScreen];
} // 정상적으로 iAd가 요청되었을때 ADBannerViewDelegate 에서 콜백되는 함수


- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    NSLog(@"didFailToReceiveAdWithError : %@",[error description]);
    [self moveBannerViewOffScreen];
} // iAd요청을 했으나, 거절되었거나 인터넷 상태가 좋지않아 광고를 받아오지 못 할 경우


대충 보시면 저 같은경우엔 UIWebView를 이용해서 iAd를 달았기 때문에 self.view가 아니라 _webView의 크기를 구하는 걸 알 수가 있을거에요~

iAd 다셔서 돈 많이 버세용..
그럼~

Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2010/07/12 10:10 2010/07/12 10:10