SWRevealViewController 右侧菜单 [英] SWRevealViewController right side menu

查看:32
本文介绍了SWRevealViewController 右侧菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 UITableView 插入位于
(来源:jeffcoat.net)

解决方案

借助在 UITableViewCell 问题中居中对齐文本修改为右侧而不是中心我能够让菜单向右对齐,最终代码如下.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath{静态 NSString *cellIdentifier = @"Cell";UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];NSInteger row = indexPath.row;if (nil == 单元格){单元格 = [[UITableViewCell 分配] initWithStyle:UITableViewCellStyleDefault 重用标识符:cellIdentifier];cell.textLabel.textAlignment = NSTextAlignmentRight;}返回单元格;}

I am experimenting inserting a UITableView into the RightViewController of the first example located at https://github.com/John-Lluch/SWRevealViewController/tree/master/RevealControllerExample .

The issue is that that the table is aligned far left and the text in each cell is cutoff.

What are possible fixes for this? I have looked through the SWRevealViewController api and could not find a solution. Also, i looked through the UITableView api and tried each of the possible alignment setting, also in the xib builder. None seems to change the cutoff of the text

I have attached the image below. Notice the left aligned table.


(source: jeffcoat.net)

解决方案

With the help of Center Align text in UITableViewCell problem modified for right instead of center I was able to get the menu to align to the right and final code is below.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    NSInteger row = indexPath.row;

if (nil == cell)
{
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault     reuseIdentifier:cellIdentifier];

    cell.textLabel.textAlignment = NSTextAlignmentRight;
}


return cell;
}

这篇关于SWRevealViewController 右侧菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆