相关疑难解决方法(0)

iOS 6/7中"无法使用表格单元索引路径"消息的含义是什么?

自从开始用iOS 6(以及iOS 7)编译我的应用程序以来,我已经开始看到这条消息了.我知道UITableViews管理单元格的方式在iOS 6中是不同的,但我不需要修改我的代码以便继续工作.但是我担心这个消息可能指向一些我还没有看到的潜在问题.谁能摆脱任何光明?

uitableview ios ios6 ios7

57
推荐指数
5
解决办法
3万
查看次数

使用uibutton ios的表视图披露指示器样式

我有一个自定义视图,我想模仿表视图单元格中找到的披露指标.这可能吗 ?无论如何提取该图像?

uibutton ios

42
推荐指数
3
解决办法
3万
查看次数

Swift - 如何使用XIB文件创建自定义viewForHeaderInSection?

我可以在编程上创建简单的自定义viewForHeaderInSection,如下所示.但是我想要做更复杂的事情,可能是与不同​​类的连接,并像tableView单元一样到达它们的属性.简单地说,我想看看我做了什么.

func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

    if(section == 0) {

        let view = UIView() // The width will be the same as the cell, and the height should be set in tableView:heightForRowAtIndexPath:
        let label = UILabel()
        let button   = UIButton(type: UIButtonType.System)

        label.text="My Details"
        button.setTitle("Test Title", forState: .Normal)
        // button.addTarget(self, action: Selector("visibleRow:"), forControlEvents:.TouchUpInside)

        view.addSubview(label)
        view.addSubview(button)

        label.translatesAutoresizingMaskIntoConstraints = false
        button.translatesAutoresizingMaskIntoConstraints = false

        let views = ["label": label, "button": button, "view": view]

        let horizontallayoutContraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-10-[label]-60-[button]-10-|", options: .AlignAllCenterY, metrics: …
Run Code Online (Sandbox Code Playgroud)

uitableview xib ios swift

33
推荐指数
3
解决办法
5万
查看次数

在Interface Builder中设计UITableView的节头

我有一个xib文件UITableView,我想使用委托方法添加自定义节标题视图tableView:viewForHeaderInSection:.有没有可能设计它Interface Builder,然后以编程方式更改它的一些子视图的属性?

UITableView有更多的章节标题,以便创建一个UIViewInterface Builder和返回这是行不通的,因为我不得不重复它,但没有做任何好的方法.归档和取消归档它不适用于UIImages所以UIImageViews会显示空白.

此外,我不想以编程方式创建它们,因为它们太复杂,结果代码很难读取和维护.

编辑1:这是我的tableView:viewForHeaderInSection:方法:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0) {
        return nil;
    }

    CGSize headerSize = CGSizeMake(self.view.frame.size.width, 100);

    /* wrapper */

    UIView *wrapperView = [UIView viewWithSize:headerSize];

    wrapperView.backgroundColor = [UIColor colorWithHexString:@"2670ce"];

    /* title */

    CGPoint titleMargin = CGPointMake(15, 8);

    UILabel *titleLabel = [UILabel labelWithText:self.categoriesNames[section] andFrame:CGEasyRectMake(titleMargin, CGSizeMake(headerSize.width - titleMargin.x * 2, 20))]; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c interface-builder uitableview ios

27
推荐指数
2
解决办法
4万
查看次数

使用Accessibility Inspector for iOS app时的AX ERROR.

我正在使用模拟器测试iPhone应用程序.每当我点击某些元素时,我都会在控制台中收到此错误:

AX ERROR: Could not find my mock parent, most likely I am stale.
Run Code Online (Sandbox Code Playgroud)

此错误似乎不会导致任何副作用.我可以使用该应用程序并自由地检查元素.知道它可能是由什么造成的吗?

iphone accessibility ios ios-simulator

20
推荐指数
1
解决办法
2763
查看次数

在故事板中创建自定义UITableview节头的最佳方法

目前我正在故事板中创建一个原型单元格,并将此单元格用作节标题.在tableView:viewForHeaderInSection:方法中,我将单元格出列并返回它.

我的节标题单元格中有一个UITextField和一个UIButton.当我点击文本字段时会出现键盘,但只要焦点从文本字段移开,整个部分标题就会消失.当我直接将单元格作为节标题视图返回时会发生这种情况,但如果我将新分配的UIView作为节标题视图返回到哪个单元格作为子视图添加,那么除了自动调整掩码外,一切正常.

为什么标题消失了?

我不确定这里最好的东西是什么.

-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    static NSString *CellIdentifier = @"SectionHeader"; 

SettingsTableViewCell *sectionHeaderCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    //return sectionHeaderCell; // returning cell directly, section header disappears when focus is moved away from text field.
UIView * headerView = [[UIView alloc] initWithFrame:sectionHeaderCell.frame];
[headerView addSubView:sectionHeaderCell];
return sectionHeaderCell;//header view never disappears, but auto resizing masks do not work. Need to know how to set autoresizing masks to headerView so that it resizes correctly.

}  
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

9
推荐指数
2
解决办法
2万
查看次数

带有故事板的自定义 tableview 部分标题并出错?

如果我使用故事板添加自定义 uitableView 部分标题,我会收到此错误AX ERROR: Could not find my mock parent, most likely I am stale.此错误是什么意思,我该如何解决?标题代码:

 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    static NSString *cellID = @"sectionHeaderID";
    UITableViewCell *headerview = [tableView dequeueReusableCellWithIdentifier:cellID];
    return headerview;
}
Run Code Online (Sandbox Code Playgroud)

iphone storyboard uitableview

1
推荐指数
1
解决办法
4860
查看次数

dequeueReusableCellWithIdentifier保持返回nil

我基本上试图做这个链接中的内容

如何使用Storyboard实现自定义表视图节页眉和页脚

在我的故事板中,我在TableViewController中嵌入了静态单元格

我选择了一个表格视图单元格并将标识符设置为"CustomHeader"(在故事板上)

以下是我的代码片段

override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        var headerView:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("CustomHeader") as? UITableViewCell

        if (headerView == nil){
            println("errrrrrr")
        }
        return headerView
    }
    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 30
    }
Run Code Online (Sandbox Code Playgroud)

但是,控制台会继续打印"errrrrrr",这意味着headerView为零.

但我认为其标识符"CustomHeader"不能为零,因为我手动选择了一个单元格并在故事板中将其标识符设置为CustomHeader !!

我是iOS的新手,所以我不知道问题是什么.

任何帮助表示赞赏.

提前致谢!

uitableview ios swift

1
推荐指数
1
解决办法
1327
查看次数