小编Kun*_*mar的帖子

在UICollectionView的单元格之间绘制虚线

我必须实现这样的目标(请查看附带的ScreenShot).我想到的最好的解决方案是UICollectionView.我在单元格上创建了​​圆形边框,并在单元格上放了一个按钮.现在的点直线我用CAShapeLayerBezierPath,并添加图层到我的collectionview background with background color set to clear color.问题来了,我没有看到任何虚线.这是我尝试过的.现在我有几个问题.回答时请考虑我作为初学者.

1)为什么我的线条没有显示.
2)如何计算两个单元格之间的宽度,现在我正在设置一个随机数.
3)是否有任何其他方法可以更有效地解决此用例.

需要

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UIBezierPath *borderPath;
CGFloat borderWidth;

KKCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"testCell" forIndexPath:indexPath];
borderPath = [UIBezierPath bezierPath];

[borderPath moveToPoint:CGPointMake(cell.frame.origin.x + cell.frame.size.width -1 , cell.frame.origin.y + 2)];
[borderPath addLineToPoint:CGPointMake(cell.frame.origin.x + cell.frame.size.width + 50,  cell.frame.origin.y +2)];
borderWidth = 1.0;
[self dottedLineWithPath:borderPath withborderWidth:borderWidth];
return cell; 
}

/** creating dotted line **/

- (void)dottedLineWithPath:(UIBezierPath *)path withborderWidth:(CGFloat)lineWidth
{
CAShapeLayer *shapelayer = [CAShapeLayer …
Run Code Online (Sandbox Code Playgroud)

core-graphics objective-c ios uicollectionview

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

如何在Xcode7中创建没有Apple Developer Program的ipa

我想要做的是create an ipa使用Xcode7进行临时分发.我没有早点完成,这是我的第一次尝试.搜索s/o并了解之前可以使用Xcode5创建ipa文件.我正在尝试这里解释方式但是我没有选择导出,如屏幕截图所示.我认为苹果可能已经改变了它,现在我们可以在使用apple开发者会员资格中注册的apple id登录后选择导出文件.我附上了之后的截图Product > Archive.正如您所看到的那样,导出选项被禁用,它要求获得Apple开发者会员资格,但能够在Finder中查看存档文件.有没有办法创建没有苹果开发者会员资格的ipa.在此输入图像描述

ad-hoc-distribution ios ipa xcode7

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

如何从swift视图中获取所有文本字段

我有一个超过15的观点UITextFields.我必须为所有人设置bottomBorder(扩展名)UITextFields.我可以为所有人UITextFields和它的工作一个接一个地设置它.我想UITextFields一次为所有人设置底部边框.这是我正在尝试的代码,但似乎for循环没有执行.我甚至尝试过,viewDidLayoutSubViews但是循环也不在那里执行.

 override func viewDidLoad() 
{
    super.viewDidLoad()

    /** setting bottom border of textfield**/

    for case let textField as UITextField in self.view.subviews {
        textField.setBottomBorder()
    }
}
Run Code Online (Sandbox Code Playgroud)

textfield ios swift

10
推荐指数
2
解决办法
5455
查看次数

如何修复 iOS9.2 上的 Xcode 错误“找不到开发者磁盘映像”

我正在尝试使用 Xcode 7.1.1 在 iOS 9.2 设备上测试我的应用程序,并收到错误消息

“找不到开发者磁盘映像”。

谷歌搜索发现,这是由于Version MismatchXcode 部署目标和 iOS 版本之间的原因。在 Xcode 7.1 上,我只能看到deployment target直到 iOS 9.1。

所以,我明白必须将我的 Xcode 更新到 7.2 版本才能部署目标 iOS 9.2。但我不想做更新。

有什么有效的方法可以在 iOS 9.2 设备上使用 Xcode 7.1 测试我的应用程序吗?

iphone xcode objective-c ios

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

UIAlertController中的选择器presentViewController没有已知的类方法

我知道这是一个非常简单的问题,我从3小时开始研究它,但却无法使其正常工作.我试图实现UIAlertController使用Apple文档显示错误消息,但我在这一行上得到错误,没有已知的选择器presentViewController的类方法[self presentViewController:alert animated:YES completion:nil];我搜索并获得了许多解决方案,但没有在这里工作.AlertMessageViewController是我的自定义类,它继承自UIViewController.

AlertMessageViewController.h

#import <UIKit/UIKit.h>
@interface AlertMessageViewController : UIViewController
+(instancetype)showAlert: (NSString *) title withMessage: (NSString*) message preferredStyle:(UIAlertControllerStyle)preferredStyle;
@end

AlertMessageViewController.m

#import "AlertMessageViewController.h"
#import <UIKit/UIKit.h>
@interface AlertMessageViewController ()
@end
@implementation AlertMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
+(instancetype)showAlert: (NSString *) title withMessage: (NSString*) message preferredStyle:(UIAlertControllerStyle)preferredStyle
{

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"title" message:@"alertMessage" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *ok =[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){NSLog(@"ok action");}];
    [alert addAction:ok];
    [self presentViewController:alert animated:YES completion:nil];
}

@end
Run Code Online (Sandbox Code Playgroud)

objective-c ios8 uialertcontroller

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