2013年6月17日 星期一
IOS APP 名稱本地化(多國語言)
1.找到您專案裏的檔案副檔名為 .plist (通常是您的bundle名稱+Info.plist)
新增一個key值,名為 Application has localized display name ,Value選擇Yes
意思為應用程式將使用本地顯示名稱
2.在專案上按右鍵,New File->選擇 IOS->Resource->Strings Files
輸入檔案名稱為InfoPlist.strings
3.點選InfoPlist.strings 在右側欄找到Localization的按鍵
4.新增您要本地化的語言
5.在各語言的InfoPlist.strings檔案中新增"CFBundleDisplayName"="您要顯示的App名稱";
2013年3月14日 星期四
Outlook2003設定密碼
2013年1月14日 星期一
UISearchBar-搜尋列整理
無搜尋結果顯示
代理:<UISearchBarDelegate>
@protocol UISearchBarDelegate <NSObject> @optional - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar; // return NO to not become first responder - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar; // called when keyboard search button pressed - (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope NS_AVAILABLE_IOS(3_0); @end |
帶有搜尋結果顯示
代理:<UITableViewDataSource, UITableViewDelegate,UISearchBarDelegate,UISearchDisplayDelegate>
@protocol UISearchDisplayDelegate <NSObject> @optional // when we start/end showing the search UI // called when the table is created destroyed, shown or hidden. configure as necessary. // called when table is shown/hidden // return YES to reload table. called when search string/option changes. convenience methods on top UISearchBar delegate methods @end |
#以下範例為使用UISearchDisplayDelegate代理的方法
搜尋元件初始化:
無scope的設定方式
searchData = [[NSMutableArray alloc] init]; |
引用代理方法:
//-----------------------------------搜尋---------------------------------------- - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString [searchData removeAllObjects]; |
有scope的設定方式
searchData = [[NSMutableArray alloc] init]; searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; searchBar.scopeButtonTitles=[NSArray arrayWithObjects:@"全部",@"加點",@"扣點", nil]; searchBar.tintColor=jobList.backgroundColor; //searchBar.tintColor=[UIColor greenColor]; // Do any additional setup after loading the view. /*the search bar widht must be > 1, the height must be at least 44 (the real size of the search bar)*/ searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; /*contents controller is the UITableViewController, this let you to reuse the same TableViewController Delegate method used for the main table.*/ searchDisplayController.delegate = self; searchDisplayController.searchResultsDataSource = self; searchDisplayController.searchResultsDelegate=self; //set the delegate = self. Previously declared in ViewController.h for (id subview in searchDisplayController.searchBar.subviews ) { if([subview isMemberOfClass:[UISegmentedControl class]]) { UISegmentedControl *scopeBar=(UISegmentedControl *) subview; [scopeBar setSegmentedControlStyle:UISegmentedControlStyleBordered]; [scopeBar setTintColor: [UIColor greenColor]];//you can also set RGB color here //scopeBar.tintColor = [UIColor blackColor]; } } self.jobList.tableHeaderView = searchBar; //this line add the searchBar |
引用代理方法:
//-----------------------------------搜尋---------------------------------------- -(void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView // - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption |