小编Tej*_*hna的帖子

如何隐藏UICollectionView的滚动条

我正在UICollectionView上课,当我滚动列表时会显示滚动条,滚动时可以隐藏滚动条吗?

ios uicollectionview

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

UITableViewCell中的IBAction未在iOS 9中调用

我有一个自定义UITableViewCell子类,其中包含IBAction从nib连接的一些方法.

在iOS 8下,一切都按预期工作.如果用户点击其中一个按钮,IBAction则调用相应的按钮.如果用户点击单元格上的任何其他位置,UITableView didSelectRowAtIndexPath则会调用该单元格.

在iOS 9下,我的IBAction方法永远不会被调用.UITableView didSelectRowAtIndexPath无论用户在单元格中的哪个位置(按钮与否),都会始终触发.

该项目是在Xcode 6/Swift 1.2下编译的.

我在Apple论坛上发现这篇文章没有解决方案.他们似乎有同样的问题.

https://forums.developer.apple.com/thread/16179

uitableview ibaction ios swift

12
推荐指数
2
解决办法
5885
查看次数

如果没有声明LSApplicationQueriesSchemes,facebook app链接如何工作?

在iOS 9中,应用程序无法用于canOpenURL检查是否安装了应用程序.

如果您的(iOS 9.0或更高版本)应用程序使用您尚未声明的方案调用此方法,则无论设备上是否安装了适用于该方案的应用程序,该方法都将返回false.

但我想知道如果没有安装应用程序,facebook app如何成功将用户引导到appstore,或者如果安装了目标应用程序则打开目标应用程序!

facebook无法列出LSApplicationQueriesSchemes中的所有应用程序!

谢谢

url-scheme ios ios9

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

当场景视图中的新视图显示时,应用程序已冻结

在我的一个iOS App开发项目中,每当我试图在ARSCNView上推送视图时.应用程序冻结在下面是我的代码.如果您了解相同的解决方案,请建议适当的解决方案.

- >在sceneView控制器上推送视图时让应用程序冻结

 let session = ARSession()
        var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration()
        var use3DOFTracking = false {
            didSet {
                if use3DOFTracking {
                    sessionConfig = ARSessionConfiguration()
                }
                sessionConfig.isLightEstimationEnabled = true
                session.run(sessionConfig)
            }
        }    
    }

override func viewDidLoad() {
        super.viewDidLoad()
        self.setupScene()
        setupSession()
}

override func viewWillAppear(_ animated: Bool) {
        self.tabBarController?.tabBar.isHidden = false
        session.run(sessionConfig, options: [.resetTracking, .removeExistingAnchors])
    }

override func viewDidDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    session.pause()
}


 func setupScene() {
        sceneView.delegate = self
        sceneView.session = session
        sceneView.antialiasingMode = .multisampling4X
        sceneView.automaticallyUpdatesLighting …
Run Code Online (Sandbox Code Playgroud)

scenekit swift arkit

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

当使用子类的collectionViewFlowLayout时,我得到了奇怪的错误

我做了一个子类collectionViewFlowLayout.之后,我实现了以下代码:

override func finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
        let attr = self.layoutAttributesForItemAtIndexPath(itemIndexPath)
        attr?.transform = CGAffineTransformRotate(CGAffineTransformMakeScale(0.8, 0.8), CGFloat(M_PI))
        attr?.center = CGPointMake(CGRectGetMidX(self.collectionView!.bounds), CGRectGetMidY(self.collectionView!.bounds))
        return attr
    }
Run Code Online (Sandbox Code Playgroud)

当我使用performBatchUpdates:方法删除集合视图中的项时,调试器会抛出此错误消息.删除实际上成功并且完全正常工作,但我对此调试器输出有点困惑.有人可以解释我应该做什么来取悦调试器吗?我真的不明白什么代码和应该添加到哪里.

//错误信息

2015-08-02 12:39:42.208 nameOfMyProject [1888:51831]仅为UICollectionViewFlowLayout缓存不匹配帧记录一次2015-08-02 12:39:42.209 nameOfMyProject [1888:51831] UICollectionViewFlowLayout缓存了索引路径的帧不匹配{length = 2,path = 0 - 11} - 缓存值:{{106.13333333333333,131.13333333333333},{75.733333333333348,75.733333333333348}}; 预期值:{{192.5,288},{94.666666666666671,94.666666666666671}}

2015-08-02 12:39:42.209 nameOfMyProject [1888:51831]这可能是因为流布局子类nameOfMyProject.ShopLayout正在修改UICollectionViewFlowLayout返回的属性而不复制它们

2015-08-02 12:39:42.209 nameOfMyProject [1888:51831]快照未渲染的视图会导致空快照.确保在屏幕更新后快照或快照之前至少渲染了一次视图.

collectionview ios uicollectionview uicollectionviewlayout

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

呈现多个WKInterfaceController(在页面基本导航中)会导致watchOS4顶部出现额外的黑色空间.

应用程序在watchOS4之前运行良好,但在watchOS4中,在WKInterfaceController顶部可以看到额外的黑色空间.这种情况只发生在目前的WKInterfaceController中,但如果我尝试推送WKInterfaceController似乎工作正常.

情况1 :

self.presentController(withNames: ["XYZ", "ABC"], contexts: nil)
Run Code Online (Sandbox Code Playgroud)

见下图,标题下方有额外的栏.

在此输入图像描述

案例2:

self.pushController(withName: "XYZ", context: nil)
Run Code Online (Sandbox Code Playgroud)

在推送方法中工作正常(在watchOS4中没有额外的空间).

在此输入图像描述

PS:我也试过了新的礼物方法:

self.presentController(withNamesAndContexts: [(name: "XYZ", context: [:] as AnyObject)])
Run Code Online (Sandbox Code Playgroud)

此外,如果我试图呈现单个接口控制器然后它工作完美,只有在我试图提出多个接口控制器(在页面中)时.

swift watchos xcode9 watchos-4

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

UITabbar项目在升级到Xcode 7之后单击之前不显示

UITabBar在升级到Xcode 7之前,我有一个运行良好的功能,现在我无法弄清楚我生活中发生了什么.我尝试了几种解决方案,包括imageWithRenderingMode为我创建的每个选项卡设置,尝试更改背景颜色UITabBar以查看是否可能只是白色的项目,并将图标本身更新为新版本.我的默认选择选项卡显示正常,然后当我选择另一个选项卡时,文本显示,但没有图像.(当移动到另一个选项卡时,文本仍然存在并更改为默认灰色.)

我附上了我所看到的截图,这就是我目前正在实现tabbar的方式.

创建tabbar的功能:

void MakeTabBar(id target)
{
    PFUser *currentUser = [PFUser currentUser];

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.recentView = [[RecentView alloc] init];
    appDelegate.groupsView = [[GroupsView alloc] init];
    appDelegate.settingsView = [[SettingsView alloc] init];
    appDelegate.homeView = [[HomeView alloc] init];

    NavigationController *navController1 = [[NavigationController alloc] initWithRootViewController:appDelegate.recentView];
    NavigationController *navController2 = [[NavigationController alloc] initWithRootViewController:appDelegate.groupsView];
    NavigationController *navController4 = [[NavigationController alloc] initWithRootViewController:appDelegate.settingsView];
    NavigationController *navController5 = [[NavigationController alloc] initWithRootViewController:appDelegate.homeView];

    appDelegate.tabBarController = [[UITabBarController alloc] init];
    appDelegate.tabBarController.tabBar.translucent = NO;
    appDelegate.tabBarController.selectedIndex = DEFAULT_TAB; …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uitabbar ios

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

回到导航控制器的屏幕时,viewDidload方法是否再次调用?

我正在使用导航控制器。我已经将两个viewcontroller推送到导航堆栈。当我使用导航栏的后退按钮从viewcontroller2返回到viewcontroller1时,再次调用viewcontroller1的方法。但据我所知,viewdidload在加载时仅被调用一次。那么为什么会这样呢?请告诉我。viewdidload

谢谢!!

viewdidload ios

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

如何在swift中创建UnsafeMutablePointer <CGPoint>对象

我需要调用UIScrollViewDelegate我不知道如何创建UnsafeMutablePointer对象的方法.

let pointer:UnsafeMutablePointer<CGPoint>  = CGPoint(x: 0, y: 1) as! UnsafeMutablePointer<CGPoint>

self.scrollViewWillEndDragging(self.collectionView, withVelocity: CGPoint(x: 0, y: 1), targetContentOffset: pointer)

func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) 
{  
     //Some code here
}
Run Code Online (Sandbox Code Playgroud)

xcode scrollview ios swift

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

接近大小限制 - 手表应用程序的大小(50MB限制令人头疼.)

我们的应用程序达到约49MB,我们不是中途.所以肯定会超过50MB的限制.我的问题如下.

1)watchOS中是否可以使用按需资源?

2)我的资源(图像,自定义字体)制作2个副本,每个是手表应用程序,其他是手表扩展.怎么解决?

3)Swift核心和其他快速框架占用大约28MB的空间.有没有办法禁用它?(PS.我们禁用了位代码)

编辑watchOS4:

以前我们的应用程序大小为44.3 MB但是当我们从xcode9大小增加到54.5时生成IPA.

iphone ios apple-watch watchkit

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