【问题标题】:how to increase height of cell for the UIImagePickerViewController如何增加 UIImagePickerViewController 的单元格高度
【发布时间】:2011-09-23 15:33:41
【问题描述】:

您好,我有 ImagePickerViewController,我需要增加单元格的高度,它看起来像 tableview,我需要增加 imagePickerviewController 的单元格高度。

I hope every one can understand my question.

i am attaching the picture 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    // Add the navigation controller's view to the window and display.
    UIImagePickerController *albumPicker = [[UIImagePickerController alloc]init];
    [albumPicker setDelegate:self];
    [albumPicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    [albumPicker setContentSizeForViewInPopover:CGSizeMake(300, 700)];

    [self.window addSubview:albumPicker.view];
    [self.window makeKeyAndVisible];

    return YES;
}

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    UINavigationItem *ipcNavBarTopItem;

    // add done button to right side of nav bar
    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Photos"
                                                                   style:UIBarButtonItemStylePlain 
                                                                  target:self 
                                                                  action:@selector(saveImages:)];

    UINavigationBar *bar = navigationController.navigationBar;
    [bar setHidden:NO];
    ipcNavBarTopItem = bar.topItem;
    ipcNavBarTopItem.title = @"Photos";
    ipcNavBarTopItem.rightBarButtonItem = doneButton;
}

对于给定的图片这是一个 UIImagePicker 我需要增加它的单元格高度。

我试试运气。谁能帮帮我。

【问题讨论】:

    标签: iphone objective-c ipad


    【解决方案1】:

    显然是 UITableView。所有单元格的高度可以在 UITableView 的 rowHeight 属性上设置,也可以在 UITableViewDelegate 的 heightForRowAtIndexPath 方法中为每个单元格单独设置。查看您的资源以了解 UITableView 的设置位置。

    【讨论】:

    • 我的代码中没有 UITableView 我刚刚调用 UIImagePickerViewController 这会自动在 tableview 单元格中显示 imagepicker
    【解决方案2】:

    要增加 TableView 单元格的高度,请执行以下方法:

    - (CGFloat)tableView:(UITableView *)tv
        heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        CGFloat height;
        height = 44;
        return height;
    
    }
    

    【讨论】:

    • 感谢它将增加 TableView 单元格的高度。但是我需要增加 UIImagePickerViewController 的高度如何控制 ImagePicker 的高度。 ??????
    • 对于 Cell 上显示的图像,尝试使用您想要的高度和宽度来 setFrame...
    猜你喜欢
    • 2017-06-23
    • 1970-01-01
    • 1970-01-01
    • 2017-04-26
    • 2018-09-13
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 2020-04-22
    相关资源
    最近更新 更多