小编UnR*_*ewa的帖子

XCode 6.3警告:合成属性

在新的Xcode 6.3中,我收到此警告:

自动属性合成不会合成属性'homeInt'; 它将由其超类实现,使用@dynamic来确认意图

我怎么能删除它?

xcode warnings dynamic

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

Swift 1.2重新声明Objective-C方法

我刚从swift 1.1更新到swift 1.2并得到编译错误:

Method 'setVacation' redeclares Objective-C method 'setVacation:'
Run Code Online (Sandbox Code Playgroud)

这里有一些代码:

var vacation : Vacation?  
func setVacation(_vacation : Vacation)
{...}
Run Code Online (Sandbox Code Playgroud)

但我需要打电话 setVacation

有什么建议如何解决这个问题?

properties redeclaration swift

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

MKMapView避免空白图块[iOS 8+]

MKMapView某些缩放lvl中,所有地图图块都是空白的.我尝试使用最大变焦解决方案.现在我用它像这样:

 func mapView(mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
        userSpan = mapView.region.span
        if mapView.zoomLevel() > maxZoomLvl
        {
            mapView.setCenterCoordinate(mapView.centerCoordinate, zoomLevel: maxZoomLvl, animated: true)
        }
    }
Run Code Online (Sandbox Code Playgroud)

但是当用户缩放到最大值时,它会缩小动画.但是我需要一些解决方案,比如原生苹果地图应用程序:只需阻止最大缩放,无法缩放深度而无需缩放.预期结果:

  1. 在最大变焦和缩放反弹时避免使用平淡的瓷砖(就像现在使用当前解决方案一样)
  2. 如果没有瓷砖地图应该停止缩放(像本机苹果地图应用程序)或地图应该缩放最后可见的瓷砖(如谷歌地图应用程序)

mkmapview ios swift

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

覆盖非动态类delaration

使用新的Xcode 8.3,我收到错误:

无法覆盖扩展中的非动态类声明

在代码行

 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
Run Code Online (Sandbox Code Playgroud)

我怎么能避免这个警告?

declaration uitableview ios swift xcode8

8
推荐指数
2
解决办法
5133
查看次数

Swift 2.0:推断闭包类型错误

我收到错误

无法在当前上下文中推断闭包类型

在使用Swift 1.2的代码中

private lazy var _messagesVC =  { return MessagesViewController(nibName:"MessagesViewController",bundle:nil)}()
Run Code Online (Sandbox Code Playgroud)

整个视图控制器,我收到此错误

import UIKit
class FriendsViewController: UIViewController {

@IBOutlet weak var containerView: UIView!
@IBOutlet weak var segmentContainerView: UIView!
private lazy var _connectionVC  =  { return FriendsConnectionViewController(nibName:"FriendsConnectionViewController",bundle:nil)}()
private lazy var _messagesVC =  { return MessagesViewController(nibName:"MessagesViewController",bundle:nil)}()


override func viewDidLoad() {
    super.viewDidLoad()
    self.selectedControllerFrom(index: 0)
     // Do any additional setup after loading the view.
}

override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)

}

func selectedControllerFrom(index index:UInt)
{
    var vc:UIViewController?
    switch index{
    case 0: vc …
Run Code Online (Sandbox Code Playgroud)

types init lazy-initialization swift

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

SDWebImage取消下载

我正在使用SDWebimage在我的tablkeview上加载图像我正在学习教程

现在我遇到了一个问题,如果我向下滚动并在图像加载之前回来,应用程序崩溃了.我怎么能解决这个问题?

如何取消SDWebImage下载.我已经经历了一些答案和讨论.但他们都没有帮助我,也无法使用它们

请帮我

我在用

  [cell.UserImage setImageWithURL:[NSURL URLWithString:[SDWebArray objectAtIndex:indexPath.row]]  placeholderImage:[UIImage imageNamed:@"Placeholder.png"]];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios sdwebimage

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

Swift中的NSMethodSignature

在ObjC我有:

NSMethodSignature *ms = [[object.target class] instanceMethodSignatureForSelector:object.selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:ms];
Run Code Online (Sandbox Code Playgroud)

在Swift中我得到错误:

'NSObject' does not have a member named 'instanceMethodSignatureForSelector'
Run Code Online (Sandbox Code Playgroud)

当我尝试这个:

var ms:NSMethodSignature? = (object.target.dynamicType as NSObject).instanceMethodSignatureForSelector(object.success)
Run Code Online (Sandbox Code Playgroud)

objective-c swift

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