小编Vin*_*odh的帖子

在某些单元格上禁用UITableView滚动

在iOS 6中,我有一个UITableView,启用了pull to refresh.在顶部单元格中,我有几个海关控件,用户可以通过拖动圆形滑块进行交互(参见此示例).见截图...

在此输入图像描述

控件需要一个标签,并且需要拖动滑块指示器的拖动但是它们可能很难抓取,因为击中似乎经常在单元格背景上,导致表格拖动开始.

如果点击事件发生在那些控件上的任何地方,我想禁用表的默认滚动.我能想到的两个选择:

  1. 禁用表格拖动该顶部单元格内的任何事件
  2. 确保控件处理更大区域上的事件,特别是在具有透明背景的部分中

有关如何实现其中任何一项的任何建议?

谢谢!

scroll touch uitableview ios

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

iOS开发者计划(99美元/年)和iOS开发者企业计划(299美元/年)之间的差异?

我想知道iOS开发人员计划iOS企业计划之间有什么不同,以及如何在iOS企业计划中公开我的应用程序.什么是可用的,我已经在iOS开发人员计划(Appstore)上传了其他我的应用程序,但我不知道知道如何在企业计划中发布.谁能帮帮我吗?

enterprise-library app-store ios

5
推荐指数
2
解决办法
6340
查看次数

MKMapview实车跟踪

我的要求是创建一个显示实时驾驶室跟踪的应用程序。像Ola,uber等著名的汽车应用程序一样。

请让我知道如何更新注解,即使是在街道转弯和倒车时。如何使用MKMapview模拟移动注释。我必须使用的任何图书馆。我搜索了但是找不到任何图书馆

objective-c mkmapview ios

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

如何在iPhone中单击UIButton时保持选定状态?

我创建了三个按钮,并为正常状态和选定状态设置背景图像.单击按钮时,将一个图像更改为选定状态.但是当滚动表视图时,不保留所选图像(先前选择的单元格),这意味着它是正常状态.

我的代码是,

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    likeBtn = [UIButton buttonWithType:UIButtonTypeCustom];

    UIImage *likeSelectedImage = [UIImage imageNamed:@"like.png"];

    //set image as background for button in the normal state

    [likeBtn setBackgroundImage:likeSelectedImage forState:UIControlStateNormal];

    [likeBtn addTarget:self action:@selector(likeAction:) forControlEvents:UIControlEventTouchUpInside];

   [cell.contentView addSubview:likeBtn];
 }
Run Code Online (Sandbox Code Playgroud)

我的按钮动作是,

 -(void) likeAction : (id) sender
 {
     UIImage *likeSelectedImg = [UIImage imageNamed:@"like-selected.png"];

     UIImage *likeImg = [UIImage imageNamed:@"like.png"];

           if ([sender isSelected]) {
               [sender setImage:likeImg forState:UIControlStateNormal];
               [sender setSelected:NO];
               }else {
               [sender setImage:likeSelectedImg forState:UIControlStateSelected];
               [sender setSelected:YES];
          }

 }
Run Code Online (Sandbox Code Playgroud)

所以我的问题是,当我滚动表视图单元格时,不保留先前选择的图像状态.因为cellForRowAtIndex方法已经反复调用,当我滚动表时.所以它会自动设定"[likeBtn setBackgroundImage:likeSelectedImage forState:UIControlStateNormal];".如何避免这个问题?那么请帮帮我吧?谢谢!

iphone uitableview

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

如何在iOS中将以下字符‡,†,*作为上标添加到NSString中

我需要追加下列字符‡, †, *为上标以NSStringiOS.需要你的帮助.我使用以下http://en.wikipedia.org/wiki/General_Punctuation_(Unicode_block)链接,但他们正在追加NSString,但我希望它们作为上标

nsstring ios ios5

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

Swift 3.0 中的 UICollectionViewController 错误:必须使用非 nil 布局参数进行初始化

我是 iOS 开发的新手。我一直在学习 Swift,今天,我尝试使用 UICollectionViewController。

我的代码如下:

 class ViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
    var colView: UICollectionView!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
        layout.sectionInset = UIEdgeInsets(top: 20, left: 10, bottom: 10, right: 10)
        layout.itemSize = CGSize(width: 90, height: 120)

        colView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
        colView.dataSource = self
        colView.delegate = self
        colView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "Cell")
        colView.backgroundColor = UIColor.white
        self.view.addSubview(colView)
    }

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> …
Run Code Online (Sandbox Code Playgroud)

ios uicollectionview swift

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

Angular JS - 当textfield失去焦点时显示验证错误

当用户离开该字段时,我想在输入字段上执行验证.

My.html

   <div ng-form="form"  novalidate>
       <input type="email" name="userEmail" class="form-control username" 
ng-model="login.username" placeholder="Email" required />
     <input type="password" name="password" class="form-control password" placeholder="Password" ng-model="login.password" required />
   <div class="invalid-message" ng-show="form.userEmail.$dirty && form.userEmail.$invalid">
    <span class="invalid-mail" ng-show="form.userEmail.$error.required">Invalid:Tell us
                            your email.</span> 
<span class="invalid-mail" ng-show="form.userEmail.$error.email">Invalid:This is not a valid email.</span>
     </div>
  </div>
Run Code Online (Sandbox Code Playgroud)

我想显示无效消息div和span,对应于email字段中的错误.现在代码工作正常.

但我的要求是在用户输入电子邮件时显示无效消息div和span.如何执行此操作您的评论是受欢迎的

请在这里找到小提琴验证演示小提琴

javascript html5 angularjs

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

无法将插件添加到phonegap Cordova 3.1.0

我正在尝试使用该命令将插件添加到cordova项目中

$ cordova plugin add org.apache.cordova.inappbrowser
Run Code Online (Sandbox Code Playgroud)

我收到以下错误消息

Fetching plugin from "org.apache.cordova.inappbrowser"...
[Error: Error fetching plugin: Error: error: Could not fetch package information for org.apache.cordova.inappbrowser]
Run Code Online (Sandbox Code Playgroud)

以下SO链接提供了一个尝试过的解决方案

Phonegap使用命令行工具添加插件

仍然得到同样的错误

ios cordova cordova-3

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

当我运行我的项目时,搜索栏没有出现在 UICollectionView 的标题中

我应该如何处理这个问题?我不知道如何将搜索栏与 UICollectionView 正确集成。请帮助我理解这个问题。

PS 我的语言是 Swift

我在 Interface Builder 中的视图 [1]

我运行项目时的看法 [2]

导入 UIKit

类 MainViewController: UICollectionViewController {

override func viewDidLoad() {
    super.viewDidLoad()
}



override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return 14
}

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TrendingGifCell", for: indexPath)
    return cell
}
Run Code Online (Sandbox Code Playgroud)

}

uisearchbar ios uicollectionview swift

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

以编程方式更改UIImageView框架大小

我有一个UImageView初始尺寸设置xib为:

Y:0,身高:406.

viewDidLoad,根据我使用此代码的条件:

self.mainAdImg.frame = CGRectMake(self.mainAdImg.frame.origin.x, self.mainAdImg.frame.origin.y + OFFSET, self.mainAdImg.frame.size.width, self.mainAdImg.frame.size.height);
Run Code Online (Sandbox Code Playgroud)

哪里 mainAdImg is the UIImageView, and OFFSET is 20.0f

所以,我希望,图像会下降20.0.

相反,新值变为:

Y : 20 (correct), height: 426 (not expected)
Run Code Online (Sandbox Code Playgroud)

为什么高度变化?

编辑:

我没有使用autolayout.

我记录原点,高度像这样:

NSLog(@" Y : %f, height : %f",self.mainAdImg.frame.origin.y,self.mainAdImg.frame.size.height);
Run Code Online (Sandbox Code Playgroud)

frame uiimageview ios

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

快速返回根视图控制器

有没有办法关闭所有视图控制器(其中一些控制器通过导航推送)并返回到根视图控制器。我看到了很多例子,但它们在我的应用程序中不起作用。我正在使用 swift 4

这是 appdelegate 中的代码

func setNavigationToRootViews(){

    storyBoard = UIStoryboard(name: "Main", bundle: nil)
    nav = storyBoard?.instantiateViewController(withIdentifier: "mainNavigation") as! UINavigationController?
    let accessToken: String? = KeychainWrapper.standard.string(forKey: "token")
    print(accessToken as Any)

   if accessToken != nil {

        let homeVc = storyBoard?.instantiateViewController(withIdentifier: "Home-VC") as! HomeViewController
        nav?.pushViewController(homeVc, animated: false)
    }else{

        let welcomVc = storyBoard?.instantiateViewController(withIdentifier: "login-VC") as! LoginViewController
        nav?.pushViewController(welcomVc, animated: false)
    }

    let leftMenuVC = storyBoard?.instantiateViewController(withIdentifier: "menu-VC") as! MenuViewController
    container = MFSideMenuContainerViewController.container(withCenter: nav, leftMenuViewController: leftMenuVC, rightMenuViewController: nil)
    container?.panMode = MFSideMenuPanModeNone
    window?.rootViewController = container
    window?.makeKeyAndVisible()

}
Run Code Online (Sandbox Code Playgroud)

这在我的最后一个视图控制器中 …

ios swift

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

UILabel 文本对齐不起作用(Swift 4)

我正在尝试对齐 UILabel 中的文本,但它不起作用。文本打印时标签的第二行紧贴标签的左侧。如何使两条线在标签中心对齐?谢谢。

let bioTextView: UILabel = {
    let tv = UILabel()
    tv.text = "This is sample text for a bio label for a user on this platform."
    tv.backgroundColor = .clear
    tv.textColor = .white
    tv.lineBreakMode = .byWordWrapping
    tv.numberOfLines = 0
    tv.textAlignment = NSTextAlignment.right
    return tv
}()
Run Code Online (Sandbox Code Playgroud)

请找到以下问题的屏幕截图。我的要求是将文本放在拖线中。

在此处输入图片说明

anchor xcode uilabel ios swift

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