私の tableViewCell では、UILabel がタップされると、ラベルがインプレース UITextField エディターになり、キーボードが下から上にスライドします。それに伴い、detailsListView を NodeCell の一番下までスクロールして、編集可能な「NodeCell」の詳細を表示します。
これを実装する方法について私が聞いた方法は、detailsViewController を上にスクロールすることです。たぶんそうかもしれませんが、タップされた UITableViewcell をインプレース編集で上部にアニメーション化すると同時に、 detailsViewController を表示する必要があります。私がオンラインで見た例は、taskListView が消えている間、destinationViewController がウィンドウいっぱいにスライドするところです。
だから私はいくつかの質問があります:
1)タップ時にUILabelをUITextFieldに変換するにはどうすればよいですか? つまり、2 つのサブビュー (1 つの UITextField と 1 つの UILabel) が必要です。1つのサブビューだけでそれを行うことはできますか? UITextField を UILabel のように見せる方法はありますか、それとも独自のカスタム UITextField を実装する必要がありますか?
これまでの私の可能な解決策: UITableView を使用して UIViewController を作成することを考えていました。 t をクリックして、UIView を指定された場所まで上にスライドさせます。私にとって、これは、2 つのビュー コントローラーを必要とせずに、1 つの UIViewController ですべてを実行できることを意味します。
何を計算しますか?
このコードを正しい方法で書いたかどうかはよくわかりません。おそらく、ドキュメントをもう一度確認する必要があります。
これは、tappedCell の下の UITableViewCells をフェードするための私の実装です。できます。
CGRect originalLocation;
CGRect newLocation;
NSInteger cellRow;
cellRow = indexPath.row;
//Retrieve all the cells below the current tapped cell excluding the current tapped cell and push them into an array
NSMutableArray *cells = [[NSMutableArray alloc] init];
for (NSInteger j = 0; j < 1; ++j)
{
for (NSInteger i = 0; i < [self.tableView numberOfRowsInSection:j]; ++i)
{
if (i != cellRow && i > cellRow){
[cells addObject:[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]]];
}
}
}
//Change the alpha of the cells below tappedCell
for (NSInteger j = 0; j < cells.count; ++j) {
cell = [cells objectAtIndex:j];
[UIView animateWithDuration:1.0
delay:0.1
options: UIViewAnimationCurveEaseOut
animations:^{
cell.contentView.alpha = 0.05;
cell.backgroundView.alpha = 0.05;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
}
//get UITableView newLocation from tableView Frame minus the tappedCell origin.
originalLocation = [self.tableView frame];//[self.tabview frame];
newLocation = originalLocation;
newLocation.origin.y = originalLocation.origin.y - rect.origin.y - 25; //I think the cell height is 25.
[UIView animateWithDuration:1.0
delay:0.1
options: UIViewAnimationCurveEaseOut
animations:^{
[self.tableView setFrame:newLocation];
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
このコードはタスクリストのフェードとスライドアップのみです。detailsList は含まれません。この権利を実装したかどうかはわかりません。これについてあなたの意見を聞きたいです。
ありがとう、
ベン