小编Soh*_*mon的帖子

UITableview在重新加载时滚动到顶部

我在我的应用程序中遇到问题 - 您可以发布和编辑您喜欢的地方.发布帖子或编辑特定帖子(UITableViewCell)后,UITableview会重新加载.

我的问题是:UITableview重新加载后滚动到顶部.但这不是我想要的.我希望我的观点留在我所在的单元格/视图上.但我不知道如何管理.

你可以帮帮我吗?

cell tableview reloaddata swift

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

iOS中的清除缓存:删除其他应用程序的应用程序数据

最近,我在iPhone上遇到了许多"清除缓存"的应用程序.它们还指定您可能会丢失一些已保存的数据和临时文件.

我所知道的是,Apple不允许您访问其他应用程序的数据.那么,他们如何清理缓存数据?谁能对它有所启发?

参考:Magic Phone Cleaner

电源清洁

iphone caching ios

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

UITableView分页 - 底部刷新以在Swift中加载新数据

我正在尝试使用分页从后端加载数据.我已经看到了这个,但它加载了所有数据,然后是时间.这是正确的方式还是我做错了什么?

提前致谢.

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
    let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell

    print(indexPath.row)

    if (indexPath.row + 1 < self.TotalRowsWithPages) {
        cell.textLabel?.text = "\(self.myarray!.[indexPath.row].body)"
    } else {

        cell.textLabel?.text = "Loading more data...";

        // User has scrolled to the bottom of the list of available data so simulate loading some more if we aren't already
        if (!self.isLoading) {
            self.isLoading = true;
            self.TotalRowsWithPages = self.TotalRowsWithPages + self.PageSize
            self.getmoredata()
        }
    }

    return cell
}
Run Code Online (Sandbox Code Playgroud)

ios swift swift2 swift3

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

自定义字体未在 Xcode 11 (macOS Catalina) 上显示

我在下拉菜单中加载自定义字体以在故事板中选择字体时遇到问题,我有 poppins 字体和 MarvinVisionsBig。我已经将它们添加为目标成员、捆绑资源并将它们添加到 plist 并且它们已经安装在系统中。我尝试了一切,但似乎没有任何效果。

使用它来显示字体时会打印字体:

for family: String in UIFont.familyNames {
    print(family)
    for names: String in UIFont.fontNames(forFamilyName: family) {
        print("== \(names)")
    }
}
Run Code Online (Sandbox Code Playgroud)

安慰:

在此处输入图片说明

落下:

在此处输入图片说明

字体:

在此处输入图片说明

捆绑资源:

在此处输入图片说明

列表:

在此处输入图片说明

xcode ios swift xcode11 macos-catalina

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

为 Mac 的 UIKit 构建,但链接框架“XXX.framework”是为 macOS 构建的

我创建了一个新应用程序,它通过 Project Catalyst 在 Xcode 11 Beta 2 上的 iPhone 和 Mac 上运行。为此,我有 2 个专门为“macOS”和“iOS”构建的框架。添加该框架后,我收到以下错误!

在此处输入图片说明

在这里,我如何向项目添加框架!

在此处输入图片说明

有人可以帮忙吗?虽然,没有添加框架项目正在运行,其中只有 2 UILabel.

macos ios swift xcode11 macos-catalina

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

Xcode 8 Pod更新问题 - 由于主要版本更新而重新创建CocoaPods

我安装了最新版本的Xcode 8 beta.我的项目由Swift 2.0开发.所以我将项目转换为Swift 3.所以我更新了pod文件.但是当我更新pod文件时,我收到错误.

Pod文件:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Alamofire', '~> 3.4'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod "SwiftSpinner"
#pod "AFNetworking", "2.5.0"
pod 'HanekeSwift'
Run Code Online (Sandbox Code Playgroud)

错误信息:

由于主要版本更新而重新创建CocoaPods.分析依赖关系[!]依赖关系Alamofire (~> 3.4)不用于任何具体目标.依赖关系SwiftyJSON (from https://github.com/SwiftyJSON/SwiftyJSON.git)未在任何具体目标中使用.依赖关系SwiftSpinner不用于任何具体目标.依赖关系HanekeSwift不用于任何具体目标.

注意:我已经使用此命令更新了cocoapods

sudo gem install cocoapods
Run Code Online (Sandbox Code Playgroud)

xcode ios cocoapods swift swift3

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

没有用Objective-C Selector声明的方法用于通知UIKeyboardWillShowNotification和UIKeyboardWillHideNotification

在最近更新Xcode之后,以前工作的代码不再有效.大多数选择器(":")都有自动更正,但此代码除外:

override func viewDidLoad() {
    super.viewDidLoad()

    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name:UIKeyboardWillShowNotification, object: nil);
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name:UIKeyboardWillHideNotification, object: nil);
}
Run Code Online (Sandbox Code Playgroud)

标记错误:

没有使用Objective C选择器'keyboardWillSHow:'声明的方法

此图像显示了所有失败的尝试.

在此输入图像描述

这段代码的新语法是什么?

keyboard uitextfield swift xcode7 swift2.2

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

应用程序在后台时,Alamofire后台上传无法打印进度

我正在使用将PDF文件上传到服务器Alamofire。我创建的backgroundSessionManager目的是确保应用程序在后台运行时上传文件。当我backgroundCompletionHandlerAppDelegatemethod 调用时,代码可以正常工作handleEventsForBackgroundURLSession

进度是我正在显示进度,当应用程序进入后台时,进度卡住了,.uploadProgress完成也没有调用。因此,当用户进入后台并且一段时间后返回时,进度不会增加。

共享实例:

class Networking {
    static let sharedInstance = Networking()
    public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this
    private init() {
        self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.dw.myapp"))

        var backgroundCompletionHandler: (() -> Void)? {
            get {
                return backgroundSessionManager.backgroundCompletionHandler
            }
            set {
                backgroundSessionManager.backgroundCompletionHandler = newValue
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

上载文件代码

Networking.sharedInstance.backgroundSessionManager.upload(multipartFormData: { (multipartData) …
Run Code Online (Sandbox Code Playgroud)

background file-upload swift alamofire

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

`curveEaseInOut`在Swift 3中不可用

在swift 3更新中,我收到此错误消息 在此输入图像描述

如果方法调用有任何变化,请告诉我.

谢谢

uiviewanimation swift3 ios10 xcode8

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

获取ScrollView Android的完整屏幕截图

事实上,在整个SO中都有解决方案和问题得到解答.所以,这是我到目前为止所尝试的!

Scroll_Layout.xml

<ScrollView
    android:id="@+id/scrollView"
    android:layout_width="0dp"
    android:layout_height="0dp"
    tools:layout_constraintTop_creator="1"
    tools:layout_constraintRight_creator="1"
    tools:layout_constraintBottom_creator="1"
    android:layout_marginStart="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    android:layout_marginEnd="8dp"
    app:layout_constraintRight_toRightOf="parent"
    android:layout_marginTop="8dp"
    tools:layout_constraintLeft_creator="1"
    android:layout_marginBottom="8dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TextView
            android:id="@+id/txtAddress"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="ADDRESS"
            android:textSize="40px"
            android:textColor="@android:color/black"/>
        <EditText
            android:id="@+id/edtName"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:hint="Enter Address"
            android:text="lorem emisidjsi damsodks"/>
        <TextView
            android:id="@+id/txtPostal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="POSTAL CODE"
            android:textSize="40px"
            android:layout_marginTop="10dp"
            android:textColor="@android:color/black"/>
        <EditText
            android:id="@+id/edtPostal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:hint="Enter Postal Code"
            android:text="123456"/>

        <TextView
            android:id="@+id/txtCity"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="CITY / GNR"
            android:textColor="@android:color/black"
            android:textSize="40px" />

        <EditText
            android:id="@+id/edtCity"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Loresm"
            android:hint="Enter City"/>
        <TextView
            android:id="@+id/txtBnr"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="BNR"
            android:textSize="40px"
            android:layout_marginTop="10dp" …
Run Code Online (Sandbox Code Playgroud)

xml android screenshot scrollview

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