336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


SCCardView


설명

뷰 밑에 있는 카드를 선택하여 상단에 있는 전체뷰를 바꿔주는 controller 입니다. 카드영역은 콜렉션뷰를 사용하였고 위에 내용이 표시되는 부분은 커스텀 하여서 원하는 목록을 넣어서 사용 할수 있습니다.

Github 주소

https://github.com/myoungsc/SCCardView

스크린샷


작업한 환경

* Swift 3.0.1
* XCode 8.3.1
* iOS 9.0 (Min SDK)

설치방법

다른 CocoaPod 처럼 설치 하시면 됩니다.

1. 터미널에서 해당 프로젝트 디렉토리로 이동한 후 'Pod init'
2. 디렉토리에 있는 PodFile에 (pod 'SCCardView')를 추가
3. 터미널에서 'pod install'

사용방법

import SCCardView

// Int index, [String: String] key, Value
// Make dummy data (Necessary key Image Card UI)
let dummyData: [Int: [String: Any]] = [0: ["image": UIImage()!,
                                          "title": "Catholic Church",
                                          "url": "https://github.com/myoungsc/SCCardView/blob/master/Example/SCCardView/Images.xcassets/sc0.imageset/sc0.jpg?raw=true",
                                          "description": "Maybe famous Catholic Churchsadl"],
                                       1: ["image": UIImage(named: "sc1")!,
                                           "title": "Beautiful Sea",
                                           "description": "Beautiful sea anywhere on earth"],
                                       2: ["image": UIImage(named: "sc2")!,
                                          "title": "Famous temple",
                                           "description": "A landscape of famous temple"],
                                       3: ["image": UIImage(named: "sc3")!,
                                          "title": "Pretty Flower",
                                          "description": "Pretty Flower\nphoto  by myoung father"],
                                       4: ["image": UIImage(named: "sc4")!,
                                          "title":"Vast Sky",
                                          "description": "Vast korea sky\nphoto by myoung father"],
                                       5: ["image": UIImage(named: "sc5")!,
                                          "title": "Leaf",
                                          "description":"Leaf anywhere on Korea\nphoto by myoung father"]]

sccard.delegate = self
sccard.cardStyle = .onlyTop
//if cardstyle round cutom
/*
 sccard.cardStyle = .custom
 sccard.initCustomCardStyle([.topLeft, .bottomRight])
 */
sccard.initialViewData(dummyData)

// Set initial value
if let dicSubData: [String: Any] = dummyData[0] {
    if let img: UIImage = dicSubData["image"] as? UIImage,
        let title: String = dicSubData["title"] as? String,
        let des: String = dicSubData["description"] as? String {
        sccardSubImg.image = img
        sccardSubTitle.text = title
        sccardSubDes.text = des
    }
}
// Autolayout bottom card ratio
contBottomDes.constant = sccard.bottomInterval


// Delegate
// Selector Card Click. Required Delegate
func SCCardSelectorCard(_ index: Int, dic: [String: Any]) {
    if let img: UIImage = dic["image"] as? UIImage,
        let title: String = dic["title"] as? String,
        let des: String = dic["description"] as? String {
        sccardSubImg.image = img
        sccardSubTitle.text = title
        sccardSubDes.text = des
    }
}

// Refresh content view from down image. Required Delegate
func SCCardURLIndexRefresh(_ img: UIImage) {
    sccardSubImg.image = img
}

// Card Down Gesture. optional Delegate
internal func SCCardDownCardAction(_ indexPath: IndexPath) {
    print("down gesture \(indexPath)")
}

// Card Up Gesture. optional Delegate
internal func SCCardUpCardAction(_ indexPath: IndexPath) {
    print("up gesture \(indexPath)")
}

라이센스

라이센스는 MIT라이센스를 따릅니다. 앱에 적용하실때는 사용하였다고 명시만 해주시면 됩니다.



'iOS 프로그래밍 > CocoaPod' 카테고리의 다른 글

SCTableIndex  (0) 2017.12.21
SCWebPreview  (0) 2017.08.30
SCPageControl  (0) 2017.08.28
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


위도와 경도로 주소 가져오기

설명

안녕하세요. 오랜만에 포스트를 올리네요. 오늘 할 포스트 내용은 iOS에서 위도와 경도를 가지고 해당 주소를 알아내는 소스코드입니다. 사진을 찍을때 위치정보가 같이 저장된다면 사진첩 어플에서 지도에 사진이 위치별로 표시되는 기능이 있습니다. 사진에 저장된 위치를 기반으로 표현을 하는겁니다. 사진에 있는 위치를 알아오는 법은 나중에 한번더 포스트해서 정리 하겠습니다. 코드 자체는 매우 간단합니다. CLLocation에 해당 위도,경도를 넣어주신 다음에 CLGeocoder 객체를 사용하셔서 받아오시면 됩니다.


사용환경

* Swift4.x
* Xcode 9.1

소스 코드

import CoreLocation

//latitude: 위도, 도: 경도
let findLocation = CLLocation(latitude: 37.576029, longitude: 126.976920)
let geocoder = CLGeocoder()
let locale = Locale(identifier: "Ko-kr") //원하는 언어의 나라 코드를 넣어주시면 됩니다.
geocoder.reverseGeocodeLocation(findLocation, preferredLocale: locale, completionHandler: {(placemarks, error) in
    if let address: [CLPlacemark] = placemarks {
        if let name: String = address.last?.name { print(name) } //전체 주소
    }
})

CLPlacemark에 들어있는 정보들

CLPlacemark에 대한 정보는 밑에 있는 도큐멘트에서 알아 볼 수 있습니다. 필요한 부분만 가져다가 쓰시면 될거 같습니다.

CLPlaceMark에 대한 애플 도큐멘트

맞치며

위치기반 시스템이 들어간 앱이라면 많이 사용 하시는 부분입니다. 포스트를 하면서 드는 생각인데 추가적으로 현재 위치를 가져오는 부분도 추가로 포스팅 작업을 하겠습니다. 틀린점이나 궁금한점 있으시면 언제든지 댓글로 말해주세요 :)



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


앱스토어 올라가는 스크린샷에 동영상을 추가해서 앱을 설명 할 수 있습니다. 그 동영상이 실제 앱이 구동되는 화면을 가지고 설명되는 동영상이면 상관이 없지만, 앱을 설명하는 동영상에 실제 화면이 포함되지 않는 동영상이 올라갈 경우 사용자에게 명확한 설명이 안되고 추상적이기때문에 애플 측에서 리젝을 합니다.


리젝 사유

Performance - 2.3.4

Your App Preview includes content that does not sufficiently reflect the app in use.
Specifically, your preview:

- Showed footage other than the app in use.

Next Steps

Please revise your App Preview to only use video screen captures of the app,
narration, and textual and design overlays.

해결 방안

동영상을 올릴경우 꼭 전체화면은 아니지만 보여지는 화면에 실제 사용되는 앱의 모습니 있어야 됩니다. 매우 간단한 해결 방안이지만 만약 리젝을 당했던 동영상이라면 동영상을 다시 만들어야 되는 문제가 발생 합니다.


마치며

처음부터 이러한 사실을 알고 있다면 좋겠지만, 보통의 경우 한번당하고 나서 알게됩니다. 직접 동영상을 만들지 않는 것이라면 영상 제작자에게 잘 얘기를 해서 수정해야되는 방향으로 가거나 아예 동영상을 삭제 해야되지 않을까 싶습니다. 리뷰를 맡기면서 느끼는 거지만 요새는 리뷰를 하루면 해주기 때문에 출시하기 일주일전에 개발자가 출시해야되는 옵션을 걸고 리뷰를 맡아 보고나서 출시일에 맞쳐서 앱을 출시 하는 것도 리젝을 피하는 하나의 방법이지 않을까 싶습니다. 틀린점이나 궁금한점 있으면 언제든지 댓글을 남겨 주세요 :)

+ Recent posts