小编Nir*_*cha的帖子

.xib文件中的UITableViewCell中的UILabel忽略暗模式

UITableViewCells.xib文件中有自己的习惯。由于Xcode 11 Beta 5(也已通过Beta 6测试),因此我UILabels忽略了“暗模式”,并且文本始终为黑色。我已将UILabel文本颜色设置为默认(标签颜色),因此它应该自动更改。有人有什么想法吗?

这是屏幕截图:第一个单元格是基本单元格,第二个单元格是.xib文件中的自定义单元格。

在此处输入图片说明

xcode ios ios13 ios-darkmode

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

IOS:致命异常:NSRangeException

该应用程序在iOS 11更新之前正常工作.在iOS 11推出之后,一些用户得到了以下崩溃但我无法在模拟器iOS 11中重现这一点.基于fabric.io,并非所有iOS 11都经历过这种情况,到目前为止我只收到了来自4个用户的22个崩溃报告.需要一些帮助,谢谢.

Fatal Exception: NSRangeException
*** -[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 1]

Fatal Exception: NSRangeException
0  CoreFoundation                 0x185b7fd38 __exceptionPreprocess
1  libobjc.A.dylib                0x185094528 objc_exception_throw
2  CoreFoundation                 0x185b18c44 _CFArgv
3  CoreFoundation                 0x185a48cc0 -[__NSArrayM removeObjectAtIndex:]
4  UIKit                          0x18f1e4aa8 -[UIPickerView selectedRowInComponent:]
5  UIKit                          0x18fa4a224 -[_UIDatePickerMode_Date _dateForYearRow:]
6  UIKit                          0x18fa46dd8 -[_UIDatePickerMode dateForRow:inCalendarUnit:]
7  UIKit                          0x18fa47a70 -[_UIDatePickerMode _updateSelectedDateComponentsWithNewValueInComponent:usingSelectionBarValue:]
8  UIKit                          0x18fa47d18 -[_UIDatePickerMode selectedDateComponents]
9  UIKit                          0x18fa3b370 -[_UIDatePickerView _updatedLastSelectedComponentsByValidatingSelectedDateWithLastManipulatedComponent:]
10 UIKit                          0x18fa3a7e8 -[_UIDatePickerView _setDate:animated:forced:]
11 UIKit                          0x18fa3ad24 -[_UIDatePickerView _setMode:]
12 UIKit …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

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

如何处理 UIViewControllerRepresentable 包装器内的 NavigationLink?

所以我正在尝试创建一个自定义分页滚动视图。我已经能够创建该包装器,并且该包装器中的内容由一个自定义视图组成。在那个自定义视图中,我有两个 NavigationLink 按钮,按下后应该会将用户带到两个不同的视图。

那些 NavigationLink 按钮不起作用。

scrollViewWrapper是NavigationView内。我创建了一个测试按钮,它只是一个简单的 Button 并且似乎有效。因此,我在使用 NavigationLink 和 custom 时没有正确执行某些操作UIViewControllerRepresentable

这是我使用自定义包装器的地方。

NavigationView {
            UIScrollViewWrapper {
                HStack(spacing: 0) {
                    ForEach(self.onboardingDataArray, id: \.id) { item in
                          OnboardingView(onboardingData: item)
                                .frame(width: geometry.size.width, height: geometry.size.height)
                       }
                    }
            }.frame(width: geometry.size.width, height: geometry.size.height)
             .background(Color.blue)
           }
Run Code Online (Sandbox Code Playgroud)

入职视图:

struct OnboardingView: View {
var onboardingData: OnboardingModel

var body: some View {
    GeometryReader { geometry in
        VStack(spacing: 10) {
            Spacer()
            Image("\(self.onboardingData.image)")
                .resizable()
                .frame(width: 300, height: 300)
                .aspectRatio(contentMode: ContentMode.fit)
                .clipShape(Circle())
                .padding(20)

            Text("\(self.onboardingData.titleText)")
                .frame(width: geometry.size.width, height: …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui navigationlink

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

在 xcode 中找不到 AppDelegate.m

我目前正在尝试将 Facebook SDK 实施到我的 Unity 应用程序中,但我找不到AppDelegate.m我必须修改才能实施 SDK 的内容。

我尝试在我的 Xcode 文件夹中到处搜索,但似乎无处可寻。

我也在谷歌上搜索,但因为我真的对 Xcode 一无所知(除了构建我的 Unity 项目),我也不明白答案......

感谢,并有一个愉快的一天 !

xcode facebook unity-game-engine

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

如何在 UNNotificationRequest 中设置重复间隔和触发日期

以前我UILocalNotification在我的应用程序中用于提醒目的。

但如上所述 API 在 iOS 10.0 中已弃用,现在需要使用 UserNotifications Framework 的UNNotificationRequest.

使用UILocalNotification我可以设置触发日期以及重复间隔,如下所示:

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

    NSDate *tomorrow = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:[NSDate date]];
    localNotification.fireDate = tomorrow;


    if(repeatUnit!=0){
          localNotification.repeatInterval = NSWeekCalendarUnit;
    }

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我可以设置明天通知触发的日期,并且我还设置了 1 周的重复间隔,该间隔将从触发日期开始。

如何使用 UserNotifications Framework 的UNNotificationRequest.

因为在新的API中我们可以使用triggerUNCalendarNotificationTriggerUNTimeintervalNotificationTrigger来启动UNNotificationRequest

有什么办法可以像这样设置两者UILocalNotification吗?

iphone xcode objective-c ios uilocalnotification

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

禁用UIScrollView的水平滚动的最佳方法是什么?

在中UIScrollView,我的内容高度和宽度大于scrollview的大小。所以基本上它可以水平和垂直滚动。我想要的是仅垂直滚动,并且UIButton通过使用以下代码来管理水平滚动。

 [scrlViewQuestion setContentOffset:CGPointMake(questionWidth, 0) animated:YES];
Run Code Online (Sandbox Code Playgroud)

防止水平滚动视图,可以仅将滚动视图内容宽度设置为小于滚动视图大小,但是在我的情况下,滚动视图内容宽度大于其大小?那么解决此问题的最佳方法是什么?

objective-c uiscrollview horizontal-scrolling contentsize

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

如何使用 Swift 5 的代理配置连接到 HTTP 服务器(为什么 connectionProxyDictionary 被忽略)?

我需要连接到 HTTP 代理后面的网络服务器。我尝试过使用URLSessionConfigurationwith connectionProxyDictionary,但似乎我的代理配置被忽略,因为您可以将代理主机值更改为任何值,结果是相同的。

\n\n

我尝试使用Charles Proxy代替我需要连接的代理来调试情况,但发现请求从未到达它,所以我相信我的客户端代码有问题。

\n\n
import Foundation\n\nclass URLSessionProxy: NSObject, URLSessionDelegate {\n\n    func doRequest() {\n\n        let configuration = URLSessionConfiguration.default\n        configuration.connectionProxyDictionary = [\n            kCFNetworkProxiesHTTPEnable: true,\n            kCFNetworkProxiesHTTPProxy: "localhost",\n            kCFNetworkProxiesHTTPPort: "8888",\n        ]\n\n        var request = URLRequest(url: URL(string: "https://ip.seeip.org/jsonip")!)\n        request.addValue("application/json", forHTTPHeaderField: "Accept")\n\n       URLSession(configuration: configuration, delegate: self, delegateQueue: OperationQueue.main)\n        .dataTask(with: request, completionHandler: { (data, response, error) in\n            if error == nil {\n                print("url request = ", request.url?.absoluteString)\n                print("headers request = ", request.allHTTPHeaderFields.debugDescription)\n                print("response = ", response)\n                print("data body …
Run Code Online (Sandbox Code Playgroud)

proxy http ios swift swift-playground

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