ユーザーが添付ファイル付きの投稿を作成できるアプリを開発しています。アタッチメントについては、次の方法UITableView
で水平モードで使用および回転しました。viewDidLoad
// Rotates the view.
CGAffineTransform transform = CGAffineTransformMakeRotation(-1.5707963);
imageAttachmentTableView.transform = transform;
ユーザーがフォトライブラリから画像を選択すると、UITableViewのimageViewに読み込まれます。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
CGAffineTransform transform = CGAffineTransformMakeRotation(1.5707963);
cell.imageView.transform = transform;
cell.imageView.frame = CGRectMake(0, 0, 110, 110);
cell.imageVenter image description hereiew.image = [imageAttachments objectAtIndex:indexPath.row];
return cell;
}
cell.imageView
画像が実際の向きで見えるように、再び反対方向に回転します
UITableViewは編集モードで作成されているため、画像が読み込まれるときに、シングルタップで画像を削除することもできます。
- (void)viewWillAppear:(BOOL)animated {
[imageAttachmentTableView setEditing: YES animated: YES];
}
また、デフォルトの「削除」テキストを「X」に変更しました
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"X";
}
次の画面のように、ユーザーが「-」ボタンをタップすると、コードはポートレートモードで完全に機能します。「X」が表示されます。
http://img5.imageshack.us/img5/1125/screenshot20121221at742.png
問題は横向きモードで、(-)ボタンは表示されますが、「X」ボタンは表示されません。 http://img833.imageshack.us/img833/6305/screenshot20121221at747.png
私はすべての可能な解決策を試しましたが、スティックを作ることができませんでした、助けてください