2012年3月31日 星期六

http://stackoverflow.com/questions/6568210/how-to-save-video-from-assets-url
http://stackoverflow.com/questions/4545982/getting-video-from-alasset

2012年3月28日 星期三

控制storyboard , reload storyboard , segue

好用參考來源
http://ryan.easymorse.com/?p=39

---------------------------

要使每次載入都回到login
可在applicationWillEnterForeground加上



    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    
    self.window.rootViewController = [storyboard instantiateInitialViewController];
    
    [self.window makeKeyAndVisible];

這樣可以reload整個storyboard,等於跟剛開啟一樣

-------------------

還有控制segue
    
    [self performSegueWithIdentifier:@"push to photolibrary" sender:nil];

詳細猜考來源

--------------------

直接載入特定storyboard

    UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    [self presentViewController:[storybord instantiateViewControllerWithIdentifier:@"PhotoLibrary"] animated:NO completion:nil];





如何製作圓角tableview, 加上textfield


    tableview.dataSource = self;
    tableview.delegate = self;
   
    //tableview 圓角 邊框 分隔線 coustom
    //圓角
    tableview.layer.cornerRadius = 13.0;
    tableview.layer.masksToBounds = YES;
    //分隔線
    [self.tv setSeparatorColor:[UIColor lightGrayColor]];
    //邊框
    tableview.layer.borderWidth = 1;
    tableview.layer.borderColor = [[UIColor lightGrayColor] CGColor];
   

    接著製作cell  並在裡面加上textfield
   
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [self.tv dequeueReusableCellWithIdentifier:CellIdentifier];
   
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier];
    }
    cell.accessoryType = UITableViewCellAccessoryNone;
    // Configure the cell...
    if([indexPath row]==0){

        //這是原本的cell text label

        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        NSString *tmp = [defaults objectForKey:@"question"];
        cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:17.0];
        cell.textLabel.text = [NSString stringWithFormat:@"%@%@", @"密碼保護問題 : ", tmp];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }else if ([indexPath row]==2) {

        /這是textfield      

        u3 = [[UITextField alloc] initWithFrame:CGRectMake(9.5, 10, 300, 60)];
        u3.placeholder = @"新密碼";
        u3.returnKeyType = UIReturnKeyDone;
        u3.delegate = self;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell addSubview:u3];      
    }

    依此類推......

}

避免textfield被鍵盤檔到

http://www.cppblog.com/kongque/archive/2011/08/24/154256.html 簡單易懂的教學

2012年3月21日 星期三

push到storyboard的view上

給 storyboard 的 view 一個Identifier

UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

[self presentViewController:[storybord instantiateViewControllerWithIdentifier:@"PhotoLibrary"] animated:NOcompletion:nil];

粗體 => 取得view

--------------------------------------------------------------------------------------

建立一個segue 並加上idIdentifier
就可利用以下方法任意觸發

[self performSegueWithIdentifier:@"touch to push" sender:nil];


資料來源:http://ryan.easymorse.com/?p=39