小编Bha*_*ani的帖子

在UINavigationBar TitleView中垂直居中标签

我没有太多的运气垂直居中我正在添加到TitleView上的标签UINavigationBar.你可以在下面看到它的样子.

文字未垂直对齐

这是我添加标签的方式:

UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.text = NSLocalizedString(@"activeSessionsTitle",@"");
titleLabel.font = [Util SETTING_NEO_HEADER_FONT];
titleLabel.textColor = [UIColor whiteColor];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.textAlignment = UITextAlignmentCenter;
titleLabel.shadowColor = [UIColor colorWithRed:0.0f/255.0f green:0.0f/255.0f blue:0.0f/255.0f alpha:0.25f];
titleLabel.shadowOffset = CGSizeMake(0.0f, -1.0f);
[titleLabel sizeToFit];

super.navigationItem.titleView = titleLabel;
Run Code Online (Sandbox Code Playgroud)

我认为它之所以这样做是因为我使用的实际字体有些奇怪 - 因为我必须在按钮内部进行大量重新定位等等.除了导航栏,我已经能够解决所有问题.

uinavigationbar uilabel ios

7
推荐指数
2
解决办法
9995
查看次数

无效更新:部分中的行数无效

我正在使用一个项目Microsoft Azure services.在删除行时,我收到此错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (2) must be equal to the number of rows 
contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out …
Run Code Online (Sandbox Code Playgroud)

xcode core-data uitableview ios azure-mobile-services

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

UITextView的建议在UITableView的浮动标题下

我有浮动标题UITableView(我想要的).但是当UITextView上面单元格中的建议视图位于标题下时,它看起来很糟糕.

好像以前没有人遇到过这个问题.有什么建议?

标题单元格UITableViewCell都是从Xib加载的.

浮动标题在其第二个最顶层视图上有一个alpha,所以它有点透视.

浮动标题位于UITextView的建议对话框之上

这是它在"调试视图层次结构"中的外观:

在此输入图像描述

uitableview ios uitableviewsectionheader

7
推荐指数
2
解决办法
507
查看次数

拉动刷新在iOS WebView中无法正常工作

我已经WKWebView在iOS中直接实现了.

   var refreshControl = UIRefreshControl()
    refreshControl.addTarget(self, action: Selector("refreshWebView"), forControlEvents: UIControlEvents.ValueChanged)
Run Code Online (Sandbox Code Playgroud)

这是在 viewDidLoad()

和相应的refreshWebView功能.但是当我在移动设备或模拟器上运行它时,无论我拖动多少,都没有拉动刷新动作.什么都没有被触发,几乎感觉我被困在屏幕的上限.哪里可能出错?

ios pull-to-refresh swift wkwebview

7
推荐指数
2
解决办法
4880
查看次数

如何在swiftUI中更改popover页面的大小和位置?

我想设置 Popover 页面的位置和大小。

func popover的所有参数我都试过了,我觉得可能和attachmentAnchor和arrowEdge有关。

这是我的代码:

    import SwiftUI

    struct ContentView : View {
        @State var isPop = false

        var body: some View {

            VStack{
                Button("Pop", action: {self.isPop = true})
                    .popover(isPresented: $isPop,  attachmentAnchor: .point(UnitPoint(x: 20, y: 20)), arrowEdge: .top, content: {return Rectangle().frame(height: 100).foregroundColor(Color.blue)})
            }

        }

    }
Run Code Online (Sandbox Code Playgroud)

我想要的效果:

图片

popover ios swiftui

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

Segment Control 的 SelectedTintColor 在 iOS 13 上不是圆角

圆角在 iOS 12 及更低版本上运行良好,但在 iOS 13 上已损坏。我创建了一个自定义 Segment 控件类。

代码:

class SegmentedControl: UISegmentedControl {
    override func layoutSubviews() {
      super.layoutSubviews()
      layer.cornerRadius = self.bounds.size.height / 2.0
      layer.borderColor = UIColor(red: 170.0/255.0, green: 170.0/255.0, blue: 170.0/255.0, alpha: 1.0).cgColor
      layer.borderWidth = 1.0
      layer.masksToBounds = true
      clipsToBounds = true

   }
}
Run Code Online (Sandbox Code Playgroud)

我已经阅读了这篇文章 -如何在 iOS 13 的 UISegmentedControl 中更改段的颜色? 但我找不到任何解决方案。

截屏: 在此处输入图片说明

uisegmentedcontrol ios swift4 ios13

7
推荐指数
2
解决办法
4854
查看次数

NSCompoundPredicate

我正在尝试UITableView's使用UISearchDisplayController和过滤数据NSCompoundPredicate.我有一个3的自定义单元格UILabels,我想在搜索中过滤所有内容,因此NSCompoundPredicate.

  // Filter the array using NSPredicate(s)

  NSPredicate *predicateName = [NSPredicate predicateWithFormat:@"SELF.productName contains[c] %@", searchText];
  NSPredicate *predicateManufacturer = [NSPredicate predicateWithFormat:@"SELF.productManufacturer contains[c] %@", searchText];
  NSPredicate *predicateNumber = [NSPredicate predicateWithFormat:@"SELF.numberOfDocuments contains[c] %@",searchText];

  // Add the predicates to the NSArray

  NSArray *subPredicates = [[NSArray alloc] initWithObjects:predicateName, predicateManufacturer, predicateNumber, nil];

  NSCompoundPredicate *compoundPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:subPredicates];
Run Code Online (Sandbox Code Playgroud)

但是,当我这样做时,编译器警告我:

不兼容的指针类型使用"NSPredicate*"类型的表达式初始化"NSCompoundPredicate*_strong"

我在网上看到的每个例子都是完全相同的,所以我很困惑.该NSCompoundPredicate orPredicateWithSubpredicates:方法采用(NSArray *)最后一个参数,所以我真的很困惑.

怎么了?

objective-c uisearchbar uisearchdisplaycontroller nscompoundpredicate

6
推荐指数
2
解决办法
7360
查看次数

带有3个标签的iOS水平UIStackView - 第一个标签将其他标签推到视线之外

我不确定我UIStackView是否理解正确.我有UIStackView一个UITableViewCell.它包含3 UILabel并设置为对齐和分配填充.

当我的第一个标签文字不长时,它看起来都很好.第二个和第三个标签占用了他们需要的空间,并且它们与右侧对齐.第一个标签占据了剩下的空间.

但是,当第一个标签包含大量文本时,它会将其他两个标签推出可见区域.我该怎么做才能确保第二个和第三个标签始终可见,并占用显示其内容所需的空间.第一个标签应始终占用剩余的可用空间,然后用"..."截断其文本

这是我在Storyboard中的配置:

UIStackView配置

这就是TableView中的结果:

UIStackView结果在UITableView中

uilabel ios autolayout swift uistackview

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

如何在 SwiftUI 中向 Button 添加多行文本?

如何声明 Button 结构体来显示多行字符串?

   import SwiftUI

    struct ContentView : View {
        var body: some View {
            return Button("Line 1 \n Line 2") {}
        }
    }
Run Code Online (Sandbox Code Playgroud)

用户界面

ios swiftui

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

在IntelliJ Idea(在Mac中)使用文件名搜索/查找文件?

在Mac中的IntelliJ创意中使用文件名查找/搜索和打开文件的键盘快捷键?

我试过跟随,但他们没有使用最新版本...

cmd+ shift+n

[要么]

ctrl+ shift+n

keyboard-shortcuts intellij-idea ios

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