2016년 12월 1일 목요일

CocoaPods

cocospads를 설치하기


cocospads는 루비를 사용해서 설치하게됩니다. 루비는 맥에 이미 설치되어 있으므로 아래와 같은
명령으로 쉽게 설치 할 수 있습니다.


$ sudo gem install cocospods
* sudo를 사용하여 CocoaPod를 설치해야하지만, 설치 한 후에는 sudo를 사용할 필요가 없습니다.


만약 제거를 원하는 경우 아래 명령어를 입력하면 됩니다.
$ sudo gem uninstall cocoapods


다음으로 아래 명령을 입력하여 설정을 완료합니다.
$ pod setup --verbose
이 과정은 '~/.cocoapods/' 경로에 'CocoaPods Master Specs 레파지토리'를 복제하므로 몇 분이 걸릴 수 있습니다.
verbose 옵션을 사용하면 프로세스가 실행될 때 정적인 화면대신 진행률을 보여주게 됩니다.
위 과정으로 CocoaPod를 사용하도록 설정하는 작업이 끝났습니다.


cocoapods를 적용하고자 하는 XCode 프로젝트 폴더 경로에서 터미널을 열어 아래의 profile 생성 명령어를 실행해줍니다.
$ pod init
프로젝트에 대한 Podfile이 만들어집니다
(위의 명령으로 설명 주석이 포함된 기본 형식을 볼수 있습니다.
touch Podfile 명령으로 아예 빈 파일로부터 편집/작성하여도 무방합니다.)

생성된 Podfile 파일을 편집하기 위해 다음 명령을 입력합니다.
$ open -a Xcode Podfile

Podfile파일의 기본 형식은 아래와 같습니다.

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'IceCreamShop' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Your Poject
end

보통 아래와 같은 방식으로 수정하여 사용합니다.

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'IceCreamShop' do
  pod 'AFNetworking', '~> 2.5'
end

* Podfile에 대한 설명 : https://guides.cocoapods.org/using/the-podfile.html


아래 명령으로 PodFile에 작성했던 라이브러리들을 설치합니다.

$ pod install


이후에 Podfile를 변경하거나 버전을 수정한 경우 아래와 같이 update명령을 사용할 수 있습니다.

$ pod update


2016년 7월 19일 화요일

adb shell에서 intent를 통해 apk설치하기

am start -a android.intent.action.VIEW -d file:///sdcard/download/app.apk -t application/vnd.android.package-archive

붉은색의 apk패스에 설치하고자 하는 경로를 적어주면 패키지 인스톨러 액티비트가 화면에 나타나게됨

2016년 3월 1일 화요일

Unity3d Mathf

Unity3d Mathf


분류함수 이름 (인수)요약
부호Abs (x)절대 값을 구함
부호Sign (x)x의 부호를 반환.
x가 음수이면 -1을 반환 양의 경우 1를 반환
삼각 함수Sin (x)사인
삼각 함수Asin (x)아크 사인
삼각 함수Cos (x)코사인
삼각 함수Acos (x)아크 코사인
삼각 함수Tan (x)탄젠트
삼각 함수Atan (x)아크 탄젠트
삼각 함수Atan2 (x, y)아크 탄젠트
소수점Ceil (x)소수점을 반올림
소수점CeilToInt (x)소수점을 반올림 Int로 반환
소수점FloorToInt (x)소수점을 버리고 Int로 반환 
소수점Round (x)소수점을 반올림
소수점RoundToInt (x)소수점을 반올림 Int로 반환
반올림Clamp (val, min, max)val을 min~max 사이에 값을 반올림
반올림Clamp01 (x)0.0~1.0의 값을 반올림
각도DeltaAngle (a, b)b에서 a의 각도 차
보완InverseLerp (from, to, t)from~to의 값을 반대로 구함
보완Lerp (from, to, t)from~to 값을 t (0.0~1.0)로 구함
보완LerpAngle (from, to, t)from~to 값 (0 ~ 360으로 반올림)를 t (0.0~1.0)에서 각도 구함
보완SmoothDamp(cur,tar,val,t,s,dt)t 초에 걸쳐 cur에서 tar로 이동하는 값을 구함
보완SmoothDampAngle(cur,tar,val,t,s dt)SmoothDamp각도 (0 ~ 360) 지원 버전
보완SmoothStep (from, to, t)from~to의 범위를 t로 구함
비교Max (a, b)a와 b를 비교하여 큰 쪽을 반환
비교Min (a, b)a와 b를 비교하여 작은 쪽을 반환
비교Approximately (a, b)Float끼리를 비교한다. 거의 일치하고 있으면 true를 반환
이동MoveToward (current, target, maxDelta)current로부터 target을 향해 maxDelta의 속도로 이동
이동MoveTowardsAngle (current, target, maxDelta)MoveToward각도 (0 ~ 360) 지원 버전
이동PingPong (t, length)t를 0~length의 범위를 왕복하도록 이동
이동Repeat (t, length)t를 0~legth의 범위를 반복한다. 정수의 나머지를 구하는 것과 같음
지수Sqrt (x)제곱근
지수Pow (x, y)x의 y 승
지수IsPowerOfTwo (x)x가 2의 거듭 제곱의 경우에 true를 반환
지수ClosestPowerOfTwo (x)x 값에서 가장 가까운 2의 n 승을 반환
지수NextPowerOfTwo (x)x의 값 이상의 가장 가까운 2의 n 승을 반환
지수Log (x, n)바닥 (n)에 대한 x의 로그
지수Log10 (x)10을 밑으로하는 x의 로그
지수Exp (n)자연 대수 e의 n 승을 반환
기타PerlinNoise (x, y)펄린노이즈를 생성
기타LinearToGammaSpace (x)선형에서 감마 색상 공간으로 값을 변형
기타GammaToLinearSpace (x)감마의 컬러 공간에서 선형으로 값을 변형

2016년 1월 30일 토요일

unity3d script - Log helper

using UnityEngine;
using UnityEngine.Assertions;
using System.Collections;
using System;

public static class LOG
{
    private static string WARN_MESSAGE =            "Warning : ";
    private static string ERROR_MESSAGE =           "Error : ";
    private static string EXCEPTION_MESSAGE =       "Exception : ";
    private static string INFO_MESSAGE =            "Info : ";

    //Each enumerated value should be a power of two
    [Flags]
    public enum DebugLevel
    {
        DEBUG_NOTHING = 0x0,
        DEBUG_WARN = 0x1,
        DEBUG_ERROR = 0x2,
        DEBUG_EXCEPTION = 0x4,
        DEBUG_INFO = 0x8
    }

    #if UNITY_EDITOR
    public static DebugLevel m_eunmDebugLevel = 
        DebugLevel.DEBUG_WARN | 
        DebugLevel.DEBUG_ERROR | 
        DebugLevel.DEBUG_EXCEPTION | 
        DebugLevel.DEBUG_INFO;
    #else
    //public static DebugLevel m_eunmDebugLevel = DebugLevel.DEBUG_NOTHING;

    public static DebugLevel m_eunmDebugLevel = 
    DebugLevel.DEBUG_WARN | 
    DebugLevel.DEBUG_ERROR | 
    DebugLevel.DEBUG_EXCEPTION | 
    DebugLevel.DEBUG_INFO;
    #endif

    public static void SetDebugLoggingLevel(DebugLevel eLevel)
    {
        m_eunmDebugLevel = eLevel;
    }

    [System.Diagnostics.Conditional("DEBUG")]
    public static void ClearConsole()
    {
        Debug.ClearDeveloperConsole();
    }

    [System.Diagnostics.Conditional("DEBUG")]
    public static void w(object cMessage)
    {
        if ((m_eunmDebugLevel & DebugLevel.DEBUG_WARN) != 0)
        {
            Debug.LogWarning(WARN_MESSAGE + cMessage);
        }
    }

    [System.Diagnostics.Conditional("DEBUG")]
    public static void e(object cMessage)
    {
        if ((m_eunmDebugLevel & DebugLevel.DEBUG_ERROR) != 0)
        {
            Debug.LogError(ERROR_MESSAGE + cMessage);
        }
    }

    [System.Diagnostics.Conditional("DEBUG")]
    public static void exception(object cMessage)
    {
        if ((m_eunmDebugLevel & DebugLevel.DEBUG_EXCEPTION) != 0)
        {
            Debug.LogException(new Exception(EXCEPTION_MESSAGE + cMessage));
        }
    }

    [System.Diagnostics.Conditional("DEBUG")]
    public static void d(object cMessage)
    {
        if ((m_eunmDebugLevel & DebugLevel.DEBUG_INFO) != 0)
        {
            Debug.Log(INFO_MESSAGE + cMessage);
        }
    }

    [System.Diagnostics.Conditional("DEBUG")]
    public static void Assert(bool condition)
    {
        UnityEngine.Assertions.Assert.IsTrue(condition);
    }
}