原创 [iOS] 指定UIView的某幾個角爲圓角
如果需要將UIView的4個角全部都爲圓角,做法相當簡單,只需設置其Layer的cornerRadius屬性即可(項目需要使用QuartzCore框架)。而若要指定某幾個角(小於4)爲圓角而別的不變時,這種方法就不好用了。 對於這種情
原创 [iOS] 繪製虛線CGContextSetLineDash的使用
畫虛線需要用到函數: CGContextSetLineDash 此函數需要四個參數: context – 這個不用多說phase - 稍後再說lengths – 指明虛線是如何交替繪製,具體看例子count – lengths數組
原创 [iOS] 統計文本長度
-(NSUInteger) unicodeLengthOfString: (NSString *) text { NSUInteger asciiLength = 0; for (NSUInteger i = 0; i
原创 [iOS] 阿拉伯數字轉漢字
<pre name="code" class="objc">// 阿拉伯數字轉漢字 + (NSString *)ChineseWithInteger:(NSInteger)integer { NSNumberFormatter
原创 [iOS] NSString類型十六進制顏色轉換
+ (UIColor *)colorwithHexString:(NSString *)color { NSString *cString = [[color stringByTrimmingCharactersInSet:[N
原创 iOS 導入支付寶時報錯找不到頭文件
解決辦法是在Header Search Paths 中添加路徑, 如圖
原创 iOS 去掉Navigation底部黑線
self.navigationController.navigationBar.shadowImage = [UIImage imageNamed:@"img"];
原创 [iOS] URLEcode, URLDecode
iOS 涉及網絡編程的時候就需要與服務器存在httpurl 交互 如果說url中存在漢字,或者需要上傳圖片,那麼就得考慮urlEncode(否則會出現網址不對) 同樣接收到服務器返回的一些信息可能也存在同樣問題,這時服務器可能會返回
原创 iOS UITextField輸入手機號時自動添加空格
需求是用戶填寫手機號時自動添加空格, 如:180 0000 0001 實現: { NSInteger _num; } _num = 0; [self.mobileTextField addTarget:self ac
原创 iOS 使用GPUImage錄製實時視頻第一幀黑屏的解決辦法
最近使用GPUImage做實時視頻濾鏡, 發現保存下來的視頻第一幀會黑屏, 在網上找解決辦法, 加入[self.videoCamera addAudioInputsAndOutputs]可以解決錄製的時候閃一下黑屏, 但是保存的視頻還是會
原创 [iOS] UIBezierPath畫圓弧 addArcWithCenter
UIBezierPath通過 - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAng
原创 [iOS] 視頻壓縮
- (void) lowQuailtyWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outputURL
原创 [iOS] 獲取當前app的名稱和版本號
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; CFShow(infoDictionary); // app名稱 NSStri
原创 [iOS] UILabel調整行間距方法
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:_detailLabel.text];
原创 cocoaPods版本更新問題
sudo gem update --system sudo gem install cocoapods pod setup pod --version sudo gem install cocoapods這一步在os x10.