原创 使用第三方APP打開文件

遵守協議  <UIDocumentInteractionControllerDelegate>屬性 @property (nonatomic, strong) UIDocumentInteractionController *doc

原创 字符串截取

1.截取字符串 NSString*string =@"iPhone"; string = [string substringToIndex:2];//截取掉下標2之後的字符串 NSLog(@"截取的值爲:%@",string);  //

原创 判斷輸入字符類型,漢字轉拼音

中文 - (BOOL) deptNameInputShouldChinese { NSString *regex = @"[\u4e00-\u9fa5]+"; NSPredicate *pred = [NSPred

原创 iOS_SQL語句詳解

// 需要在靜態區定義一個指針 (讓這個指針指向的對象 從程序開始到結束 一直存在 程序結束後被系統自動釋放) static sqlite3 *db = nil; // 打開數據庫 - (sqlite3 *)openDB {

原创 打印中文

#import <Foundation/Foundation.h> @interface NSArray (MyLog) @end @interface NSDictionary (MyLog) @end #import "N

原创 iOS 獲取步數等健康信息

導入HealthKit.framework info.plist中添加權限配置 <!-- 健康分享 --> <key>NSHealthShareUsageDescription</key> <string>App需要您的同意

原创 UIlabel,文字複製

首先創建一個類繼承於UILabel;因爲label默認是不接收事件的,我們需要自己給label添加touch事件。 /* 1.給label添加touch事件 */ -(void)addTouch{ self.userInterac

原创 UIAlertConntroller

默認樣式 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"標題" message:@"這個是UIAlertControl

原创 Tableview添加索引

//添加索引欄標題數組 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { NSMutableArray *resultAr

原创 調用系統瀏覽器打開網址

NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"]; [[UIApplication sharedApplication] openURL:url];

原创 退出程序

#pragma mark - 退出程序 - (void)exitApplication { wulianAppDelegate *app = [UIApplication sharedApplication].delega

原创 國際化/多語言

一.手動切換 1.創建工程 2.工程-PROJECT-info->Localizations,點“+”,選擇(Chinese(Simplified))添加簡體中文,英文Xcode自帶有(English),所以不需要再次添加。 3.創建s

原创 調用系統設置頁面和WIFI設置頁面

調用系統設置頁面 NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; if ([[UIApplication sharedApplicat

原创 Label適應文字大小

- (CGFloat)infoLbSize { CGSize maxSize = CGSizeMake(self.frame.size.width, MAXFLOAT); NSDictionary *attrs = @{N

原创 調用麥克風錄音及播放

導入AVFoundation.framework 引入#import <AVFoundation/AVFoundation.h> //定義屬性 { //錄音器 AVAudioRecorder *recorder;