if(strpos($agent,'iphone') || strpos($agent,'ipad')) { $type ='ios'; } if(strpos($agent,'android')) { $type ='android';
oschina.net/u/2340880/blog/608560 iOS中播放gif動態圖的方式探討 一、引言 在iOS開發中,UIImageView類專門來負責圖片數據的渲染,并且UIIm
來自: http://www.cocoachina.com/ios/20160126/15091.html 如何辨別項目中的中文字符串? 既然要替換項目中使用到的中文字符串,那么前提就必須要先
可以監聽有電話來時候的一些狀態 #import <coretelephony ctcallcenter.h=""> #import <coretelephony ctcall.h=""> -(void)detectCall { CTCallCenter *callCenter = [[CTCallCenter alloc] init]; callCenter.callEventHandler=^(
/////禁止全局 橫屏 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ return UIInterfaceOrientationMaskPortrait; } //橫屏調整視圖 - (void)layoutSubv
獲取當前設備的IP地址和MAC地址: 1.導入相關庫文件。 2.調用方法getIPAddress 調用方法getMacAddress。 // // GetForIPMac.m // Eric // // Created by Eric on 15-3-24. // Copyright (c) 2015年 yons. All rights reserved. // #import "GetForIP
JSON); } failure:nil]; [operation start]; 說實話,IOS中的寫法真是繁瑣,不過字面意思確實表達足夠精確。 2,Swift中 若要使用AFN
//判斷輸入文本中字符串的長度 if ([self convertToInt:chooseRollTextField.text] > 20) { [self showToast:@"輸入的角色名不能超過20個漢字或40個字符哦!"]; return; } - (int)convertToInt:(NSString*)strtemp { int strlength = 0; char* p = (c
['HTTP_USER_AGENT'], 'iPad')){ echo 'systerm is IOS'; }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
在- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions 里添加 self.window.rootViewController.view.alpha = 0; UIImageView *splashImageView = [[UIImageV
在IOS開發中,經常有限制圖片文件大小的,有的用戶圖片很大,導致上傳時間慢,造成問題。 如:微信分享中,如果圖片的大小好像大于50kbytes,就分享失敗,而且沒有任何提示。 所以,我添加了兩個函數:
ios UI數據庫 sqlite小型數據庫的增、刪、改、查、排序 #import?"table.h" @implementation?table // 1.創建表?每一列之間用'
#import <AVFoundation/AVFoundation.h> - (BOOL)isHeadsetPluggedIn { AVAudioSessionRouteDescription* route = [[AVAudioSession sharedInstance] currentRoute]; for (AVAudioSessionPortDescription* desc in [
去掉狀態欄尺寸 CGRect?r = [?UIScreen?mainScreen ].applicationFrame; r=0,20,320,460 屏幕尺寸 CGRect?rx = [?UIScreen?mainScreen ].bounds; r=0,0,320,480 狀態欄尺寸 CGRect?rect; rect?=?[[UIApplication?sharedApplication]?
//四舍五入 /** * 浮點型數據四舍五入 * * @param format 保留兩位小數 傳入@"0.00"; * @param floatV 字符數據 * * @return 四舍五入保留兩位后的字符串 */ +(NSString *) decimalwithFormat:(NSString *)format floatV:(float)floatV { NSNumberFormatter
在一些應用中,我們需要用到iOS設備的攝像頭進行拍照,視頻。并且從相冊中選取我們需要的圖片或者視頻。 關于iOS攝像頭和相冊的應用,可以使用UIImagePickerController類來完成控制。
- (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size{ // 創建一個bitmap的context // 并把它設置成為當前正在使用的context UIGraphicsBeginImageContext(size); // 繪制改變大小的圖片 [img drawInRect:CGRectMake(0,0, size.width, si
什么是 MD5: 全稱是 Message Digest Algorithm 5 ,譯為 “ 消息摘要算法第 5 版 ” 效果:對輸入信息生成唯一的 128 位散列值( 32 個字符) MD5 的特點: 輸入兩個不同的明文不會得到相同的輸出值 根據輸出值,不能得到原始的明文,即其過程 不可逆 MD5 的應用: 由于 MD5 加密算法具有較好的安全性,而且免費,因此該加密算法被廣泛使用 主要運用在數字
示例代碼簡單易懂: 每日更新關注 : http://weibo.com/hanjunqiang 新浪微博 #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property (weak, nonatomic) IBOutlet UILabel *dayLabel; @property (weak, nonat
我們都知道tableview的實現原理,就是創建當前可見個數的tablecell,滾動過程中只是更改不可見的tablecell到可見的位置并且更新數據。這樣可以避免滾動很多屏不用創建相應的視圖,這樣就不會造成內存泄漏。