PIXNET Logo登入

阿勇的blog

跳到主文

歡迎光臨阿勇在痞客邦的小天地

部落格全站分類:不設分類

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 8月 27 週三 201417:41
  • notification results in “unrecognized selector sent to instance…”

NSNotificationCenter try to post it when Observer had release. So, just need to remove Observer.
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(11)

  • 個人分類:Objective-C
▲top
  • 7月 08 週二 201415:08
  • 防止繼承的delegate跟原本的衝突(how to extend a protocol for a delegate in objective C)

@interface PlaceView () <MapViewDelegate> {
id placeSelegate;
}
@end
@implementation PlaceView
- (id)init
{
self = [super initWithSearch];
if (self) {
super.delegate = self;
}
return self;
}
# pragma mark public PlaceView
- (void)setDelegate:(id)delegate
{
placeSelegate = delegate;
}

- (void)done
{
if ([
placeDelegate respondsToSelector:@selector(placeSelected:)])
{
[
placeDelegate placeSelected:[map placeInfo]];
}
}
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(56)

  • 個人分類:Objective-C
▲top
  • 6月 24 週二 201411:04
  • 在iOS連線中,保留session

只需要將cookie存在cookieStorage裡即可 - (NSData *)send:(NSHTTPURLResponse**)urlResponse
{
NSError *errorState = nil;
NSData *result = [NSURLConnection sendSynchronousRequest:request returningResponse:urlResponse error:&errorState];
// process cookie
NSArray *allCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:[*urlResponse allHeaderFields] forURL:[*urlResponse URL]];
if ([allCookies count]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:allCookies forURL:[*urlResponse URL] mainDocumentURL:nil];
}
return result;
}
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(4)

  • 個人分類:Objective-C
▲top
  • 5月 09 週五 201416:20
  • convert color code to UIColor

+ (UIColor*)colorWithColorCode:(NSString*)hex
{
NSString *cString = [[hex stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 or 10 characters
if ([cString length] < 6) return [UIColor grayColor];
// strip 0X if it appears
if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];
if ([cString length] != 6 && [cString length] != 8) return [UIColor grayColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];
range.location = 2;
NSString *gString = [cString substringWithRange:range];
range.location = 4;
NSString *bString = [cString substringWithRange:range];
NSString *aString = @"FF";
range.location = 6;
if ([cString length] == 8)
aString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b, a;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
[[NSScanner scannerWithString:aString] scanHexInt:&a];
return [UIColor colorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:((float) a / 255.0f)];
}
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(4)

  • 個人分類:Objective-C
▲top
  • 5月 06 週二 201417:23
  • white line on iOS7

今天突然發現我的元件上有一條白線,
不管是用path或讀圖畫出來的都後。
而且iOS6,還沒事。
google後,才發現是antialias搞。
CGContextSetShouldAntialias(context, NO); 參考
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(0)

  • 個人分類:Objective-C
▲top
  • 2月 11 週二 201414:48
  • Objective-C 也可以像json一樣宣告NSArray和NSDictionary

NSArray *words = @[@"list", @"of", @"words", @123, @3.14];
NSDictionary *d = @{ @"key": @"value" };
參考資料
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(25)

  • 個人分類:Objective-C
▲top
  • 1月 13 週一 201416:12
  • 連結xcode裡Storyboard的viewcontroller

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"myViewController"];
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(0)

  • 個人分類:Objective-C
▲top
  • 7月 12 週五 201320:50
  • IOS autorelease 錯誤

使用autorelease一直有錯誤ARC forbids explicit message send of'release''release' is unavailable: not available inautomatic reference counting mode
解法
(繼續閱讀...)
文章標籤

阿勇 發表在 痞客邦 留言(0) 人氣(1)

  • 個人分類:Objective-C
▲top
1

個人資訊

阿勇
暱稱:
阿勇
分類:
不設分類
好友:
累積中
地區:

熱門文章

  • (179)利用freetype轉出bitmap點陣字
  • (23)在Qt中,使用系統預設的圖示
  • (19)在mac中,建立應用程式的圖示(icns)
  • (6)迷香
  • (3)在SQL中,當二個鍵同時相等時,唯一鍵成立。

文章分類

  • 替代役的日子 (5)
  • 黑色鈣片 (4)
  • java (3)
  • picasa (1)
  • lua (1)
  • mingw (1)
  • nsis (1)
  • squirrel (1)
  • freetype (1)
  • bitmap font (7)
  • windows (5)
  • c (1)
  • NetBeans (2)
  • uml (1)
  • html5 (1)
  • Wheel Light (4)
  • Qt (26)
  • opengl (6)
  • chrome (2)
  • hg (2)
  • mac (4)
  • apns (1)
  • python (4)
  • php (2)
  • SQL (4)
  • iOS (3)
  • xcode (4)
  • Objective-C (8)
  • phonegap (1)
  • swift (1)
  • cordova (2)
  • 未分類文章 (1)

最新文章

  • Cordova速記
  • Cordova run simulation
  • swift速記
  • cordova發布到andriod
  • 迷香
  • notification results in “unrecognized selector sent to instance…”
  • 分開設定xcode的configureration
  • 關於doesNotRecognizeSelector引起的exception crash
  • 在SQL中,當二個鍵同時相等時,唯一鍵成立。
  • 防止繼承的delegate跟原本的衝突(how to extend a protocol for a delegate in objective C)

最新留言

  • [15/08/24] 阿勇 於文章「3D text on Qt with O...」留言:
    抱歉很久回這裡了,今天才看到你的留言 你說的很多錯誤,是指?...
  • [15/06/29] 匿名 於文章「3D text on Qt with O...」留言:
    阿勇大大你好, 請問一下這個範例是可以輸入文字後將他轉成3D...
  • [12/05/30] 匿名 於文章「利用freetype轉出bitmap點陣...」留言:
    mac os x 10.7.4 gcc -o ayong ...
  • [11/10/02] 匿名 於文章「安裝程式-nsis...」留言:
    請問 MUI 跟 MUIXP 以外的介面怎麼設定的ㄚ?...
  • [09/02/24] 阿勇 於文章「Script language~Lua和...」留言:
    最近看到一個squirrel http://squirrel...
  • [09/02/24] 阿勇 於文章「Script language~Lua和...」留言:
    Lua有點冷門,而且好像沒有oo的慨念。...
  • [09/02/15] Barros Lee 於文章「Script language~Lua和...」留言:
    我推 Lua...

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: