반응형

반응형

// 1. 파란색 투명한 공 모양으로 지도에 현재 위치를 나타낸다.

_mapView.showsUserLocation = YES;


// 2. 현재의 위치를 지도의 가운데로 위치시키고 영역 폭을 50미터로 변경.

MKUserLocation *userLocation = _mapView.userLocation;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.location.coordinate, 50, 50);


[_mapView setRegion:region animated:NO];


// 3. 사용자 이동에 따른 MapView 업데이트 하기.

_mapView.delegate = self;


- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    _mapView.centerCoordinate = userLocation.location.coordinate;
}


// 4. 맵 뷰에 어노테이션 추가하기.(예. 마이크로소프트의 본사가 위치한 워싱텅주의 레드몬드)

CLLocationCoordinate2D locationCoordinate2D;
   
locationCoordinate2D.latitude = 47.640071;
locationCoordinate2D.longitude = -122.129598;
   
 MKPointAnnotation *pointAnnotation = [[MKPointAnnotation alloc] init];
 pointAnnotation.coordinate = locationCoordinate2D;
 pointAnnotation.title = @"Microsoft";
 pointAnnotation.subtitle = @"Microsoft's headquarters";
 [_mapView addAnnotation:pointAnnotation];

반응형
Posted by 컴스터
,

로컬 노티피케이션

IPHONE 2014. 1. 16. 17:32
반응형

1. 로컬 노티피케이션 예약하기.

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // 백그라운드로 간후 10초후 발생.
    NSDate *alertTime = [[NSDate date] dateByAddingTimeInterval:10];
    UIApplication *app = [UIApplication sharedApplication];
    UILocalNotification *notifyAlarm = [[UILocalNotification alloc] init];
   
    if (notifyAlarm)
    {
        notifyAlarm.fireDate = alertTime;
        notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
        notifyAlarm.repeatInterval = 0;
        notifyAlarm.soundName = @"bell_tree.mp3";
        notifyAlarm.alertBody = @"Staff meeting in 30 minutes";
        [app scheduleLocalNotification:notifyAlarm];
    }
}


2. 예약된 노티피케이션 취소하기.

UIApplication *app = [UIApplication sharedApplication];

NSArray *oldNotifications = [app scheduledLocalNotifications];


if([oldNotifications count] > 0)

[app cancelAllLocalNotifications];


3. 첫번째 로컬 노티피케이션 즉시 호출하기.

NSArray *notifications = [app scheduledLocalNotifications];

if([notifications count] > 0)

[app presentLocalNotificationNow:notifications[0]];

반응형
Posted by 컴스터
,
반응형

// 세피아 톤 적용.

- (void)drawRect:(CGRect)rect
{
    // Drawing code
    UIImage *myimage = [UIImage imageNamed:@"image.jpg"];
    CIImage *cimage = [[CIImage alloc] initWithImage:myimage];
    CIFilter *sepiaFilter = [CIFilter filterWithName:@"CISepiaTone"];
    [sepiaFilter setDefaults];
    [sepiaFilter setValue:cimage forKey:@"inputImage"];
    [sepiaFilter setValue:[NSNumber numberWithFloat:0.8f] forKey:@"inputIntensity"];
   
    CIImage *image = [sepiaFilter outputImage];
    CIContext *context = [CIContext contextWithOptions:nil];
    CGImageRef cgImage = [context createCGImage:image fromRect:image.extent];
   
    UIImage *resultUIImage = [UIImage imageWithCGImage:cgImage];
   
    CGRect imageRect = [[UIScreen mainScreen] bounds];
    [resultUIImage drawInRect:imageRect];
}

반응형

'IPHONE' 카테고리의 다른 글

MKMapView에 현재 위치 표시.  (0) 2014.01.20
로컬 노티피케이션  (0) 2014.01.16
화면에 맞게 이미지 그리기.  (0) 2014.01.16
String Format Specifiers  (0) 2014.01.16
아이폰 터치 스크린 제스처 인식하기 예제  (0) 2014.01.14
Posted by 컴스터
,
반응형




1. 성공노트는 하루 단위로 할일 목록을 입력한후 우선순위로 배치하여 완료된 일은 체크 해나가면서 사용하시면 좋습니다.

2. 성공노트는 꾸준히 사용하는 분에게 효과가 있습니다.


성공노트 바로 가기.


https://itunes.apple.com/kr/app/seong-gongnoteu/id776483996?mt=8


반응형

'My App' 카테고리의 다른 글

멘도롱 제주 앱이 출시 되었습니다.  (0) 2015.04.08
독서 노트가 출시 되었습니다.  (0) 2014.05.13
Posted by 컴스터
,
반응형

- (void)drawRect:(CGRect)rect
{
    // Drawing code
    UIImage *myImage = [UIImage imageNamed:@"image.jpg"];
    CGRect imageRect = [[UIScreen mainScreen] bounds];
    [myImage drawInRect:imageRect];
}

반응형

'IPHONE' 카테고리의 다른 글

로컬 노티피케이션  (0) 2014.01.16
이미지에 필터적용하기.  (0) 2014.01.16
String Format Specifiers  (0) 2014.01.16
아이폰 터치 스크린 제스처 인식하기 예제  (0) 2014.01.14
파일 자르기  (0) 2014.01.07
Posted by 컴스터
,

String Format Specifiers

IPHONE 2014. 1. 16. 10:15
반응형
https://developer.apple.com/library/mac/documentation/cocoa/conceptual/strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265-SW1


반응형

'IPHONE' 카테고리의 다른 글

이미지에 필터적용하기.  (0) 2014.01.16
화면에 맞게 이미지 그리기.  (0) 2014.01.16
아이폰 터치 스크린 제스처 인식하기 예제  (0) 2014.01.14
파일 자르기  (0) 2014.01.07
파일에 데이터 쓰기.  (0) 2014.01.07
Posted by 컴스터
,
반응형

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *theTouch = [touches anyObject];
    _startPoint = [theTouch locationInView:self.view];
    CGFloat x = _startPoint.x;
    CGFloat y = _startPoint.y;
    _xCoord.text = [NSString stringWithFormat:@"x = %f", x];
    _yCoord.text = [NSString stringWithFormat:@"y = %f", y];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *theTouch = [touches anyObject];
    CGPoint touchLocation = [theTouch locationInView:self.view];
    CGFloat x = touchLocation.x;
    CGFloat y = touchLocation.y;
    _xCoord.text = [NSString stringWithFormat:@"x = %f", x];
    _yCoord.text = [NSString stringWithFormat:@"y = %f", y];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *theTouch = [touches anyObject];
    CGPoint endPoint = [theTouch locationInView:self.view];
    _xCoord.text = [NSString stringWithFormat:@"start = %f, %f", _startPoint.x, _startPoint.y];
    _yCoord.text = [NSString stringWithFormat:@"end = %f, %f", endPoint.x, endPoint.y];
}

반응형

'IPHONE' 카테고리의 다른 글

화면에 맞게 이미지 그리기.  (0) 2014.01.16
String Format Specifiers  (0) 2014.01.16
파일 자르기  (0) 2014.01.07
파일에 데이터 쓰기.  (0) 2014.01.07
파일에서 데이터 읽기  (0) 2014.01.07
Posted by 컴스터
,

파일 자르기

IPHONE 2014. 1. 7. 17:16
반응형

// truncateFileAtOffset 메서드를 사용하여 특정한 오프셋에서 파일을 잘라낼 수 있다.

// 전체 파일의 내용을 잘라내려면 오프셋을 0으로 설정하고 이 메서드를 호출하면 된다.


   NSFileHandle *file = [NSFileHandle fileHandleForUpdatingAtPath:@"filePath"];
   
    if (file == nil)
    {
        NSLog(@"Failed to open file");
    }
   
    [file truncateFileAtOffset:0];
    [file closeFile];

반응형
Posted by 컴스터
,
반응형

    NSFileHandle *file;
    NSMutableData *data;
   
    const char *bytestring = "black dog";
    data = [NSMutableData dataWithBytes:bytestring length:strlen(bytestring)];
   
    file = [NSFileHandle fileHandleForUpdatingAtPath:@"filePath"];
   
    if (file == nil)
    {
        NSLog(@"Failed to open file");
    }
   
    [file seekToFileOffset:10];
    [file writeData:data];
   
    [file closeFile];

반응형
Posted by 컴스터
,
반응형

NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:@"filePath"];
    if (file == nil)
    {
        NSLog(@"Failed to open file");
    }
   
    [file seekToFileOffset:10];
    NSData *databuffer = [file readDataOfLength:5];
   
    [file closeFile];

반응형
Posted by 컴스터
,


반응형