Tag: cocoa触摸

如何设置iOS UITextField边框颜色? (RubyMotion + iOS)

如何使用RubyMotion设置textField边框颜色? 示例代码: textField = UITextField.alloc.init textField.borderStyle = UITextBorderStyleLine 边框颜色显示为Apple默认颜色; 我希望它是红色的。 这是使用RubyMotion,而不是Objective-C

为什么我的UITabBar在纵向加载时向下移动20个像素?

我正在UINavigationController加载UITabBarController 。 默认情况下, UITabBar的UITabBarController将它放在视图的底部。 通过使用默认选项,在横向启动应用程序时,该栏将在底部正确显示。 这也使肖像正确显示在底部,(但只有当横向模式启动应用程序)。 如果我以纵向方式启动应用程序,则会在两个横向上向下移动状态栏的高度: 和肖像: 我正在尝试与CNBC应用程序产生类似的效果,并在视图顶部显示UITabBar 。 在回顾了Mihai Damian的问题之后,我试图自定义UITabBar。 我只是简单地添加了几行代码: -(void)loadView{ UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; contentView.backgroundColor = [UIColor clearColor]; self.view = contentView; [contentView release]; orderingTabBarController = [[UITabBarController alloc] init]; OrderingSpecialsViewController *specialsViewController = [[OrderingSpecialsViewController alloc] initWithNibName:@"OrderingSpecialsViewController" bundle:nil]; OrderingProductViewTabBarController *productViewTabBarController = [[OrderingProductViewTabBarController alloc] init]; OrderingSummaryViewController *summaryViewController = [[OrderingSummaryViewController alloc] init]; […]

计算中的小数点。 要么 ,

如果我使用小数点input数字小数点的变化取决于国家和地区的格式。 可能是一个点“。” 或作为逗号“,” 而且我无法控制应用程序在哪个设备上使用。 如果区域格式使用逗号,则计算出错。 join5,6就是一次只能input5次,同样是56次。 即使我以编程方式允许这两个。 并作为TextField中的input。 如何在不使用数字标点的情况下进行此操作,并且可能还必须给出使用逗号避免input的说明“ 这只是input数字和十进制我需要和小数点是如此之多更好。

iOS:UITableViewController – cellForRowAtIndexPath单元格创build

我知道苹果文档没有指定cellForRowAtIndexPath顺序,即首先它将去0节,索引0; 然后第0节,索引2; 然后第1部分,索引0 ….等等。 我觉得它跳了起来。 什么是更好的方式来完成下面的? 目前我不断收到错误 NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 2]' 错误出现b / c我认为cellForRowAtIndexPath跳转并标记*sectioned = NULL ,所以条件被跳过,并进入一个空数组或超出索引计数通过转到错误的条件。 这里是代码: … declared and synthesized NSManaged *object; @property (strong, nonatomic) NSNumber *sevenDaysSectionFilled; @property (strong, nonatomic) NSNumber *fourteenDaysSectionFilled; @property (strong, nonatomic) NSNumber *thirtyDaysSectionFilled; – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { object […]

无法更改SKView backgroundColor

这是与iOS 9.我无法设置一个SKView的背景颜色,它总是呈现与默认的灰色。 有没有解决的办法? let frame = CGRect(x: 0, y: 0, width: 200, height: 100) let spriteView = SKView(frame: frame) spriteView.backgroundColor = .blueColor() self.view.addSubview(spriteView) 当上面的代码运行时,SKView是灰色的而不是蓝色的。 我真正想要能够做的是设置allowsTransparency = true但我不能让这个工作,如果我不能改变背景颜色clearColor 。 其他人遇到这个? 任何解决方法? 更新 即使有@达尼洛的build议,这仍然显示为灰色: let frame = CGRect(x: 0, y: 0, width: 200, height: 100) let spriteView = SKView(frame: frame) spriteView.backgroundColor = .clearColor() spriteView.allowsTransparency = true spriteView.opaque […]

边界的中心

我有一个全屏的UIScrollView来显示我的图像,它采用从苹果示例代码从PhotoScroller.app一些代码。 我对获得imageScrollView边界的中心点有点困惑。 ImageScrollView.m – (CGPoint)pointToCenterAfterRotation { NSLog(@"imageScrollView frame X and Y are %f and %f ",self.frame.origin.x, self.frame.origin.y); NSLog(@"imageScrollView frame Width and Height are %f and %f ",self.frame.size.width, self.frame.size.height); NSLog(@"imageScrollView bounds origin X and Y are %f and %f ",self.bounds.origin.x, self.bounds.origin.y); NSLog(@"imageScrollView bounds Width and Height are %f and %f ",self.bounds.size.width, self.bounds.size.height); NSLog(@"imageView frame origin X […]

是否可以为MKMapView上的用户定位销设置一个固定的屏幕位置?

我试图build立一个MKMapView的方式,用户的位置将永远是偏移在视图控制器的右上angular,我将围绕该“块”构build我的用户界面的其余部分。 有没有办法为MKMapView设置一个固定/偏移中心点,例如,引脚始终位于屏幕上的x,y位置? 如果您无法理解我的目标,我可以提供一个草图示例。

从CIImage转换它后UIImage横向

我在UIImage应用filter,但转换后,它显示为侧面。 以下是我的代码。 CIImage *ciImage = [[CIImage alloc] initWithImage:self.imgToProcess]; CIFilter *filter = [CIFilter filterWithName:@"CIPhotoEffectChrome" keysAndValues:kCIInputImageKey, ciImage, nil]; [filter setDefaults]; CIContext *context = [CIContext contextWithOptions:nil]; CIImage *outputImage = [filter outputImage]; CGImageRef cgImage = [context createCGImage:outputImage fromRect:[outputImage extent]]; UIImage *newImage = [[UIImage alloc]initWithCIImage:outputImage]; 它在newImage和尺寸中成功呈现,但图像是侧面的。 上面的代码中有没有导致方向改变的地方?

尝试构build用于iOS的SSCrypto框架时构build失败

使用Xcode 4,我试图构build与iOS应用程序一起使用的SSCrypto框架。 在“生成设置”中,当我将基础SDK更改为Latest iOS时,出现此错误: target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform 我的谷歌search已经空了,所以我觉得我失去了明显的东西… 如何让SSCrypto框架在iOS上运行?

每次旋转组件时,UIPickerView似乎都在泄漏

更新: 在我看来,这几乎是一个苹果的错误。 我尝试了以下内容: 创build一个新的单窗口项目 创build一个如下所示的单个UIPickerView,只是select器只允许转动拨号盘。 也就是说,交互选取器时,variables和状态都不会被操纵。 结果:无论是使用简单的titleForRow:forComponent还是viewForRow:forComponent,每次转动拨号盘时,选取器仍然会泄漏48个字节。 此外,我甚至尝试让picker返回先前在viewController中设置为类属性的数组中的视图,这样就不会保留或释放视图,但对于picker在调用委托方法之后或之后可能执行的任何操作。 而且还会发生泄漏。 看起来像一个苹果的bug对我来说。 原文问题 我有一个textField的imputView被设置为一个UIPickerView与4个组件。 选取器用于select成为textField中文本的重量/质量。 在“乐器”下,每次在UIPickerView中打开拨号/组件时,都会发生泄漏: 以下是48字节泄漏的堆栈跟踪: UIPickerView通过其获取每个组件视图的代码是: – (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if(!view) { view = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 37)] autorelease]; UILabel *label = (UILabel*)view; label.autoresizingMask = UIViewAutoresizingFlexibleWidth; label.textAlignment = UITextAlignmentCenter; label.font = [UIFont boldSystemFontOfSize:24]; label.backgroundColor = [UIColor clearColor]; } […]