Bluetooth On/Off 와 비슷하나 dylib 에서 가능하다고 함.


1. On app


notify_post("com.yourcompany.yourapp.yournotification");


2. On dylib


#import <SpringBoard/SBWiFiManager.h>


HOOK(SpringBoard, applicationDidFinishLaunching$, void, id app)
{

    // Listen for events via DARWIN NOTIFICATION CENTER

    CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, &NotificationReceivedCallback, CFSTR("com.yourcompany.yourapp.yournotification"), NULL, CFNotificationSuspensionBehaviorCoalesce);
}


// THIS IS WHERE THE MAGIC HAPPENS
static void NotificationReceivedCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)

{

    [[objc_getClass("SBWiFiManager") sharedInstance] setWiFiEnabled:NO];
}


관련링크: http://stackoverflow.com/questions/2053114/iphone-wi-fi-manager-sdk


'Mobile > iOS' 카테고리의 다른 글

Bluetooth On/Off  (0) 2012.07.25
Launch image 효과  (0) 2012.07.24
상태바 스타일 변경  (0) 2012.07.24
HTTP 파일 이어받기  (0) 2012.07.11
Rounded corners on a view  (0) 2012.07.02

아래의 방법은 AppStore 의 리뷰를 통과하지 못할 것이라고 알고있음.


1. GameKit Framework 추가


2. 다음 코드를 수행하여 BTServer 와 연결

Class BluetoothManager = objc_getClass("BluetoothManager");

[BluetoothManager sharedInstance];


3. 다음 코드로 상태 변경 (setEnabled 또는 setPowered 메소드 사용)

id btCont = [BluetoothManager sharedInstance];

[btCont setEnabled:![btCont enabled]];

'Mobile > iOS' 카테고리의 다른 글

WiFi On/Off  (0) 2012.07.25
Launch image 효과  (0) 2012.07.24
상태바 스타일 변경  (0) 2012.07.24
HTTP 파일 이어받기  (0) 2012.07.11
Rounded corners on a view  (0) 2012.07.02

application:didFinishLaunchingWithOptions: 에서 여러가지 효과를 줄 수 있다.


NSThread.sleepForTimeInterval: 을 사용하여 보여지는 최소 시간을 보장할 수 있다.



Launch image 를 보여주는 view 를 만들어 앱이 보여질 때 FadeIn 효과를 줄 수 있다.


UIImage *image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"]];

UIView *imageView = [[UIImageView alloc] initWithImage:image];

[image release];

imageView.frame = self.window.bounds;

[self.window addSubview:imageView];


[UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionLayoutSubviews animations:^{

    imageView.alpha = 0.0f;

} completion:^(BOOL finished) {

    [imageView removeFromSuperview];

    [imageView release];
}];


'Mobile > iOS' 카테고리의 다른 글

WiFi On/Off  (0) 2012.07.25
Bluetooth On/Off  (0) 2012.07.25
상태바 스타일 변경  (0) 2012.07.24
HTTP 파일 이어받기  (0) 2012.07.11
Rounded corners on a view  (0) 2012.07.02

plist 에 "Status bar style" 을 추가하여 원하는 값을 선택한다.


[UIApplication sharedApplication].statusBarStyle 속성을 사용할 수도 있지만 이 경우 Launch image 에서는 기본 Status bar 로 보여 이상해진다.


'Mobile > iOS' 카테고리의 다른 글

Bluetooth On/Off  (0) 2012.07.25
Launch image 효과  (0) 2012.07.24
HTTP 파일 이어받기  (0) 2012.07.11
Rounded corners on a view  (0) 2012.07.02
in-house 배포시 배포 URL  (0) 2012.05.24

retainCount 매커니즘을 흉내내보았다.

객체할당시 4바이트를 추가로 할당하여 retainCount 영역으로 사용.

실사용은 해보지 않은 코드이므로 충분한 검증이 필요하다.



쉬면서 해놓은거 같은 코드가 temp 폴더에 있어서 옮겨놈.

해당 예제는 one thread 로 multi thread 코드로 바꾸어 메인 작업이 중단되지 않게 사용하면 되겠다.



viewDidAppear: 에서 view 를 닫게 하였을때 발생함.

보여지는 과정이 끝난 직후에 발생한 메소드라 이곳에서 안보여지게 하는 코드를 사용하면 발생하는 듯.

performSelector:withObject:afterDelay: 를 이용해 0.1 초 후에 동작시켜 해결함.

아래 코드는 사용해 보지 않은 메모용 코드임.


NSMutableURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];


NSString *range = [[NSString alloc] initWithFormat:@"bytes=%d-", offset];

[request setValue:range forHTTPHeaderField:@"Range"];

[range release];


'Mobile > iOS' 카테고리의 다른 글

Launch image 효과  (0) 2012.07.24
상태바 스타일 변경  (0) 2012.07.24
Rounded corners on a view  (0) 2012.07.02
in-house 배포시 배포 URL  (0) 2012.05.24
[Simulator] 단축키  (0) 2012.05.02

"viewController implementation of -viewDidUnload caused the view to be reloaded. This will adversely impact system performance."


low memory warning 시에 이런 메세지가 뜬다면, viewController 의 viewDidUnload 의 코드중에 view 를 다시 load 하게 만드는 코드가 존재하는 것이다.


self.view

self.tableView


이런식의 코드들은 view 를 다시 load 하게 만드므로 viewDidUnload 에는 넣지 말도록 하자.


UITableView 의 배경색을 바꾸면 iPhone 에서는 정상 적용이 되나 iPad 에서는 기본값으로 나온다.

tableView 의 backgroundView 에 빈 view 를 하나 생성해주면 된다.


UIView *view = [[UIView alloc] init];

self.tableView.backgroundView = view;

[view release];


+ Recent posts