2014. 1. 3. 15:43 아이폰

포문으로 계속해서 한 함수만 호출할때 

아래와 같은방법을 선언하고 포문에서 함수호출을 하는 방법이 다른 어떤 방법 보다 

심지어 직접 연산을 넣거나 직접 함수를 호출하는 부분 보다 속도가 빠르다고 한다 ...

파라메터가 없을 경우만일거 같은데 .. 책에서는 

파라메터 없는 함수 호출의 경우에서 말했다 

책 objective-c 3판 224페이지 표 8-1


앞으로 무한으로 도는 함수호출의 경우 아래의 경우를 애용해야겠다

1.tydef 선언한경우


typedef int (*f) (id,SEL,int,int);

        f fPoint;

        fPoint = (int(*)(id,SEL,int,int))[self methodForSelector:@selector(testFunctionPoint:B:)];

        NSLog(@"%d",(*fPoint)(self ,@selector(testFunctionPoint:B:),1,2));

2.그냥 사용인 경우

int (*fPoint)(id,SEL,int,int);

        fPoint = (int(*)(id,SEL,int,int))[self methodForSelector:@selector(testFunctionPoint:B:)];

        NSLog(@"%d",(*fPoint)(self ,@selector(testFunctionPoint:B:),1,2));



-(int)testFunctionPoint:(int)a B:(int)b

{

    return a+b;

}

'아이폰' 카테고리의 다른 글

ios 텍스트 이미지 디폴트 공유 - ios shared text image  (0) 2015.04.09
ios auto focus check  (0) 2014.11.18
앱에서 이미지 동영상 겔러리로 저장  (0) 2013.10.28
ios custom keyboard  (0) 2013.06.12
ios arc mrc 설정하기  (0) 2013.03.26
posted by 욱이다
2013. 10. 28. 15:55 카테고리 없음



-(void)getVideoThumbnail:(NSURL *)url

{

    //혹시나 쓸까해서 비디오 썸네일 가져오기

    AVURLAsset *asset=[[AVURLAsset alloc] initWithURL:url options:nil];

    AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];

    generator.appliesPreferredTrackTransform=TRUE;

    [asset release];

    CMTime thumbTime = CMTimeMakeWithSeconds(0,30);

    

    AVAssetImageGeneratorCompletionHandler handler = ^(CMTime requestedTime, CGImageRef im, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error){

        if (result != AVAssetImageGeneratorSucceeded) {

            NSLog(@"couldn't generate thumbnail, error:%@", error);

        }

                   [button setImage:[UIImage imageWithCGImage:im] forState:UIControlStateNormal];

                   thumbImg=[[UIImage imageWithCGImage:im] retain];

                   [generator release];

    };

    

    CGSize maxSize = CGSizeMake(320, 180);

    generator.maximumSize = maxSize;

    [generator generateCGImagesAsynchronouslyForTimes:[NSArray arrayWithObject:[NSValue valueWithCMTime:thumbTime]] completionHandler:handler];

    

}


    IOS GET VIDEO THUMBNAIL

posted by 욱이다
2013. 10. 28. 15:53 아이폰


앱에서 이미지 겔러리로 저장

-(void)saveImageatAlbum:(UIImage *)img

{

    //이미지 저장

    [loadingView startLoading];

    UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

    

}

- (void) image:(UIImage*)image didFinishSavingWithError:(NSError *)error contextInfo:(NSDictionary*)info

{

    [loadingView endLoading];

    if(error == nil)

    {

        [mCp setPopUpSimple:LOCSTRING("이미지 저장 성공!")];

    }else

    {

        [mCp setPopUpSimple:LOCSTRING("이미지 저장 실패!")];

    }

}


앱에서보는 동영상 겔러리로 저장

- (void) downloadVideo:(NSString *)url

{

    //동영상 저장

    [loadingView startLoading];

    

    [self performSelectorOnMainThread:@selector(downloadVideoGo:) withObject:url waitUntilDone:NO];

}

-(void)downloadVideoGo:(NSString *)url

{

    NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];

    NSString *tempPath = [NSString stringWithFormat:@"%@temp.mp4", NSTemporaryDirectory()];

    [imageData writeToFile:tempPath atomically:NO];

    UISaveVideoAtPathToSavedPhotosAlbum (tempPath, self, @selector(video:didFinishSavingWithError: contextInfo:), nil);

}

- (void) video: (NSString *) videoPath didFinishSavingWithError:(NSError *)error  contextInfo:(void *)contextInfo

{

    [loadingView endLoading];

    if(error == nil)

    {

        [mCp setPopUpSimple:LOCSTRING("동영상 저장 성공!")];

    }else

    {

        [mCp setPopUpSimple:LOCSTRING("동영상 저장 실패!")];

    }

    

}


IOS SAVE GALLERY APP IMAGE AND VIDEO

'아이폰' 카테고리의 다른 글

ios auto focus check  (0) 2014.11.18
objective-c 함수포인터를 사용한 함수 호출  (0) 2014.01.03
ios custom keyboard  (0) 2013.06.12
ios arc mrc 설정하기  (0) 2013.03.26
ios gridview  (0) 2013.03.22
posted by 욱이다
2013. 10. 22. 09:59 안드로이드

how to check started service in android ?

영어로는 이렇게 나와있드라고요 ...


<uses-permission android:name="android.permission.GET_TASKS" />


private boolean isServiceRunning(String serviceName)

{

ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);

List<ActivityManager.RunningServiceInfo> l = am.getRunningServices(Integer.MAX_VALUE);

Iterator<ActivityManager.RunningServiceInfo> i = l.iterator();

while (i.hasNext())

{

ActivityManager.RunningServiceInfo runningServiceInfo = (ActivityManager.RunningServiceInfo) i

.next();

if (runningServiceInfo.service.getClassName().equals(serviceName)) { return true; }

}

return false;

}





if(isServiceRunning("kr.my.test.MessageShowService"))

{

Intent ppp = new Intent(getActivity(), MessageShowService.class);

getActivity().stopService(ppp);

}



'안드로이드' 카테고리의 다른 글

ANDROID LISTVIEW GET HEIGHT  (0) 2014.01.15
TranslateAnimation click work  (0) 2014.01.11
안드로이드 커스텀 xml 사용  (0) 2013.08.30
무조건 status bar 보이기  (0) 2013.08.20
Android Asynchronous Http Client  (0) 2013.08.08
posted by 욱이다
2013. 8. 30. 23:53 안드로이드

android custum layout xml
// CustomView.java

public class CustomView extends LinearLayout {

    public CustomView(Context context) {
        super(context);
        init(context);
    }

    public CustomView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public CustomView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }

    private void init(Context ctx) {
        LayoutInflater.from(ctx).inflate(R.layout.view_custom, this, true);
            // extra init
    }

}



// view_custom.xml

    <!-- Views -->
</merge>

'안드로이드' 카테고리의 다른 글

TranslateAnimation click work  (0) 2014.01.11
안드로이드 서비스 돌고있는지 체크  (0) 2013.10.22
무조건 status bar 보이기  (0) 2013.08.20
Android Asynchronous Http Client  (0) 2013.08.08
Eclipse Attach Source  (0) 2013.02.26
posted by 욱이다
2013. 8. 20. 17:05 안드로이드

android status bar 갑자기 hidden 

view above status bar

camera after activity view 

구글에 검색좀 되라고 .. 영어로 


WindowManager.LayoutParams attrs = getWindow().getAttributes();

{

attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;

}

getWindow().setAttributes(attrs);

posted by 욱이다
2013. 8. 8. 16:42 안드로이드

한글로 잘 설명된 블로그 

http://edoli.tistory.com/91


대표 블로그

http://loopj.com/android-async-http/



한번 써봐야겠다 



document


http://loopj.com/android-async-http/doc/com/loopj/android/http/RequestParams.html





RequestParams params = new RequestParams();

params.put("DEVICEID", WanjaApplication.GetDeviceIdObtain(this));

AsyncHttpClient client = new AsyncHttpClient();

// 포스트 방식일때

client.post("http://www.naver.com/", params,new ResponseHandler());

//겟 방식 일때 

client.get("http://www.naver.com/a?dfasd=1&dfas=2", new ResponseHandler());


class ResponseHandler extends AsyncHttpResponseHandler {
@Override
public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
// TODO Auto-generated method stub
Log.i("AA", "onFailure " + arg0 + " " + arg2 + " " + arg3.toString());
for (int i = 0; i < arg1.length; i++) {
Log.i("AA", "onFailure " + arg1[i].getName() + " " + arg1[i].getValue() + " ");
}
super.onFailure(arg0, arg1, arg2, arg3);
}

@Override
public void onFinish() {
// TODO Auto-generated method stub
Log.i("AA", "onFinish ");
loading.dismiss();
super.onFinish();
}

@Override
public void onStart() {
// TODO Auto-generated method stub
Log.i("AA", "onStart ");
loading.show();
super.onStart();
}

@Override
public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
// TODO Auto-generated method stub

Log.i("AA", "onSuccess " + arg0 + " " + arg2);
for (int i = 0; i < arg1.length; i++)
Log.i("AA", "onSuccess " + arg1[i].getName() + " " + arg1[i].getValue() + " ");
super.onSuccess(arg0, arg1, arg2);
}

@Override
protected void sendMessage(Message msg) {
// TODO Auto-generated method stub
Log.i("AA", "sendMessage " + msg);
super.sendMessage(msg);
}

@Override
public void sendResponseMessage(HttpResponse arg0) throws IOException {
// TODO Auto-generated method stub
Log.i("AA", "sendResponseMessage " + arg0.toString());
super.sendResponseMessage(arg0);
}

}


'안드로이드' 카테고리의 다른 글

안드로이드 커스텀 xml 사용  (0) 2013.08.30
무조건 status bar 보이기  (0) 2013.08.20
Eclipse Attach Source  (0) 2013.02.26
안드로이드 커스텀 폰트 사용 (android custom font)  (0) 2012.11.14
프로가드 제외하기  (0) 2012.08.09
posted by 욱이다
2013. 6. 12. 10:11 아이폰


CustomInputViewDemo-master.zip

http://blog.carbonfive.com/2012/03/12/customizing-the-ios-keyboard/


커스텀 키패드 좋네 


'아이폰' 카테고리의 다른 글

objective-c 함수포인터를 사용한 함수 호출  (0) 2014.01.03
앱에서 이미지 동영상 겔러리로 저장  (0) 2013.10.28
ios arc mrc 설정하기  (0) 2013.03.26
ios gridview  (0) 2013.03.22
NSString encoding decoding  (0) 2013.03.22
posted by 욱이다
2013. 5. 28. 13:56 카테고리 없음

아....

NX300 사진도 잘나오고 

와이파이 연결도 좋은데 



문제가 있는데 ..

오토모드로 사진을 찍으면 사진이 너무 어둡게 나온다는 말이지 ..


근데 REMOTE VIEW FINDER로 찍으면 사진이 오토모드로 찍히게 되어져서 어둡게 나온단 말이지 


난 NX300의 REMOTE VIEW FINDER모드가 좋아서 샀는데 ;;;


펌웨어 업그레이드 되면 밝아 지려나 ...


어디 NX300 개발자 게시판이있다면 요거 좀 적어 놔주고 싶네 



REMOTE VIEW FINDER모드로 했을때 최근에 설정한 모드로 세팅해서 찍게 하면 안되나...


뭐 블로그 보면 다 좋다는 말뿐이라서 

나도 좋기는 다 좋은데 이게 문제란 말이지 ... 

애기사진을 어둡게 찍어서 어따 쓰냐고 ...


posted by 욱이다
2013. 3. 26. 15:36 아이폰
http://blog.naver.com/solarin4314?Redirect=Log&logNo=50161892672

http://j2enty.com/102



위의 두 블로그 보면 

arc mrc 설정하는 방법이있다 


프로젝트 초반에 설정하는 방법

프로젝트에서 설정하는 방법

소스별로 설정하는 방법

-fobjc-arc


-fno-objc-arc

'아이폰' 카테고리의 다른 글

앱에서 이미지 동영상 겔러리로 저장  (0) 2013.10.28
ios custom keyboard  (0) 2013.06.12
ios gridview  (0) 2013.03.22
NSString encoding decoding  (0) 2013.03.22
Ios NSArray 에 NSArray 더하기  (0) 2013.03.22
posted by 욱이다
prev 1 2 3 4 5 6 7 8 ··· 16 next