Tag: ios

如果部分标题隐藏在UICollectionView中,则删除空白空间

我在UICollectionView有两个部分。 我只想在UICollectionView显示节标题。 不在第0节。 所以我试图返回nil viewForSupplementaryElementOfKind : section == 0方法,并返回section == 1视图。 它崩溃,并显示下面的错误: Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes]: 这里是我的补充视图的代码。 – (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { UICollectionReusableView *sectionHeader = nil; if (kind == UICollectionElementKindSectionHeader && indexPath.section == 1) { sectionHeader = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"EventSectionHeader" forIndexPath:indexPath]; sectionHeader.layer.borderWidth = .5f; sectionHeader.layer.borderColor = [UIColor colorWithRed:221.0 / 255.0 […]

iOS __kindof NSArray?

我一直在检查iOS 9的新function作为开发人员,其中一些像StackView看起来很棒。 当我去了UIStackView的头文件,我看到这个: @property(nonatomic,readonly,copy) NSArray<__kindof UIView *> *arrangedSubviews; 什么是NSArray * __kindof。 我们现在能够在NSArray *上指定一个types吗? 小testing: @interface DXTEST () @property (strong, nonatomic) NSMutableArray <__kindof NSString *> *strings; @end @implementation DXTEST – ( instancetype ) init { self = [super init]; if( self ) { _strings = [NSMutableArray new]; [_strings addObject:@(1)]; <– compiler warning wieeeeee } return self; […]

了解convertPoint:toView:

我不太明白的方法convertPoint:toView: 在苹果的文档中写道 convertPoint:toView: 将接收器坐标系中的点转换为指定视图的点。 – (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view 但是,从一个到另一个的转换实际上是什么意思呢? 这是否意味着这两个边界的点有不同的单位 ? 或只是不同的价值观? 如果是后者,为什么有这样一种方法,当我们可以简单地将a的contentOffset的值赋给b的时候呢? CGPoint a = [a contentOffset]; [b setContentOffset:a]; convertPoint:toView:与简单分配contentOffset什么不同? 还是我误解了整个概念? 转换点实际上是做什么的? 何时应该使用这种方法?

UITableView滚动事件

我想检测如果mytable视图已经滚动,我尝试了所有的触摸事件,如: – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; //my code } 但似乎所有的触摸事件都不响应滚动,但只有当单元格被触摸,移动,等等时才会响应 有没有办法来检测UITableView的滚动事件?

UIPageViewController页面控制背景颜色

我在我的应用程序中使用UIPageViewController,它工作正常。 但是,它自动添加的页面控件具有隐藏当前视图控制器底部材质的黑色背景(请参阅下图)。 是否有可能调用UIPageViewController的页面控件并更改它的颜色? 我希望页面控制显示在视图控制器(例如,path应用程序的演练),如设置颜色而不是黑色清除。

以编程方式访问应用程序标识符前缀

如何以编程方式访问Bundle Seed ID / Team ID / App Identifier Prefixstring? (据我所知,这些都是一样的东西)。 我正在使用UICKeychainStore钥匙串包装器将数据保存在多个应用程序中。 这些应用程序中的每个应用程序在其授权plists中都有一个共享的钥匙串访问组,并共享相同的设置configuration文件。 默认情况下,钥匙串服务使用plist中的第一个访问组作为存储数据的访问组。 当我debuggingUICKeychainStore时,这看起来像“AS234SDG.com.myCompany.SpecificApp”。 我想设置访问组为“AS234SDG.com.myCompany.SharedStuff”,但我似乎无法find如何获得编程的访问组的“AS234SDG”string,并希望避免硬编码它如果可能的话。

当我运行pod安装时,我得到`master` repo需要CocoaPods 0.32.1,尝试更新但仍然在0.31

Iam试图在xcode项目中安装cocoa豆荚,但是在做: $ pod install 我得到以下错误: Setting up CocoaPods master repo [!] The `master` repo requires CocoaPods 0.32.1 – Update CocoaPods, or checkout the appropriate tag in the repo. /Library/Ruby/Gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:281:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError) 所以我更新了cocoa豆 $ sudo gem update cocoapods 但它告诉我没有什么可更新的: Password: Updating installed gems Nothing to update 运行pod –version 但是我得到: […]

点击手势识别器 – 哪个对象被点击?

我是手势识别器的新手,所以也许这个问题听起来很愚蠢:我将轻拍手势识别器分配给一堆UIViews。 在这个方法中,有可能找出哪个是被点击的,或者我需要使用屏幕上的点来找出它? for (NSUInteger i=0; i<42; i++) { float xMultiplier=(i)%6; float yMultiplier= (i)/6; float xPos=xMultiplier*imageWidth; float yPos=1+UA_TOP_WHITE+UA_TOP_BAR_HEIGHT+yMultiplier*imageHeight; UIView *greyRect=[[UIView alloc]initWithFrame:CGRectMake(xPos, yPos, imageWidth, imageHeight)]; [greyRect setBackgroundColor:UA_NAV_CTRL_COLOR]; greyRect.layer.borderColor=[UA_NAV_BAR_COLOR CGColor]; greyRect.layer.borderWidth=1.0f; greyRect.userInteractionEnabled=YES; [greyGridArray addObject:greyRect]; [self.view addSubview:greyRect]; NSLog(@"greyGrid: %i: %@", i, greyRect); //make them touchable UITapGestureRecognizer *letterTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(highlightLetter)]; letterTapRecognizer.numberOfTapsRequired = 1; [greyRect addGestureRecognizer:letterTapRecognizer]; }

如何在Xcode 4.5中添加旧版本的iOS SDK?

我在这里复制了iOS 5.1 SDK: 应用程序/ Xcode.app /内容/开发/平台/ iPhoneOS.platform /开发商/软件开发工具包 但是,我仍然无法在Xcode中select基本的SDK。 任何人都可以帮忙吗?

UILabel:你如何设置字体大小?

你如何设置UILabel的字体大小? 我的代码: UILabel *myView = [[UILabel alloc] initWithFrame:RectFrame]; [myView setBackgroundColor:[UIColor blueColor]]; [myView setText:[NSString stringWithFormat:@" A"]]; [myView setFont:[12] ]; <— Error [self.view addSubview:myView];