草庐IT

WORK_DIR

全部标签

ios - 如何绘制(_ rect : CGRect) actually work?

我不明白这个函数是如何工作的如果我想更改“View”的背景颜色,我将访问View的背景属性并更改它的值letcontainerView=CustomView(frame:CGRect(x:0,y:0,width:400,height:400))containerView.backgroundColor=UIColor.blue但是当我想在draw()函数中改变矩形的颜色时我只是调用UIColor.green.set()函数。为什么这个函数会改变矩形的颜色classCustomView:UIView{overridefuncdraw(_rect:CGRect){super.draw(re

ios - swift : Why localization sometime need to add observer to get it work but sometime don't

我已经开发了一个需要使用本地化的应用程序,所以我选择了thisnicelibrary为我的申请。但我只是混淆了他们的文档中提到他们需要使用观察者通知来收听语言何时发生变化。但是在我的主Controller中,我只是按照他们说的去做,它就像一个魅力一样工作,但是当我将本地化添加到我的侧边栏文本时。我收到这个错误:原因:'-[NSConcreteNotification长度]:发送到实例0x107cbb9f0的无法识别的选择器'但是如果我删除侧边栏Controller内的观察者。它会工作正常。所以我的问题是为什么有些Controller需要添加一个观察者才能工作,而有些则不需要添加它来工作

ios - [ self.navigationController popViewControllerAnimated :YES ]; doesn't work in delegate callback

我有A->B->CController,与下一个委托(delegate)链接:@protocolViewControllerDelegate-(void)onResult:(ControllerDelegateObject*)delegateObject;@end在C中我调用:-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{ControllerDelegateObject*object=[[ControllerDelegateObjectalloc]init]

objective-c - UIBezierPath 包含点 : don't work correctly?(更新 : touch location in superview how to handle?)

所以我有2个UIViews女巫可以绘制bezierpath然后返回路径。然后我需要检查路径是否包含我在[pathcontainsPoint:currentObject.position]的帮助下执行此操作的点,它适用于其中一个View,但不适用于另一个View。一个View在iPhone的上半部分,另一个View在下半部分。最下面那个不行我试过切换View,还是一样的问题,最下面那个不行。这是一些代码:在主视图Controller中:-(void)didEndPath:(UIBezierPath*)pathDrawView:(DrawView*)draw{if([pathcontain

html - 我怎样才能使位置 :fixed work on iOS 7?

我创建了一个测试网页来演示UIWebView和MobileSafari上的position:fixed问题:Test*{-webkit-tap-highlight-color:rgba(0,0,0,0);}body{margin:0px;padding:0px;}.fullscreen{background:transparent;display:block;position:absolute;top:0;left:0;width:100%;height:100%;}.screen{position:fixed;left:0px;top:0px;width:100%;height:10

ios - 执行选择器 : didn't work properly when using dispatch_async and global_queue

我想问一下performSelector:方法需要自己的runloop定时器才能正常工作有什么潜在的原因,因为如果我不专门为他设置一个runloop,他就会辞职!-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{NSLog(@"touchesBegan---%@",[NSThreadcurrentThread]);dispatch_async((dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0)),^{[selfperformSelector:@

IOS : Custom Layouts does not work, CollectionView:cellForItemAtIndexPath: 未调用方法

大家好,我是swift的新手,我正在尝试学习使用CollectionView,我正在学习本教程:CustomLayouts:AWorkedExample不幸的是它不适合我。我注意到CollectionView:cellForItemAtIndexPath:方法没有被调用,我认为这可能是主要问题。我将文件放在以下链接中:Workingfile,如果有人知道这个问题,请让我帮忙。非常感谢 最佳答案 您的自定义布局类有问题。如果您将布局类更改为默认流布局-一切正常,那么您可能需要查看布局类代码。我在layoutAttributesForE

java - iOS + appium java 客户端 : Long press TouchAction does not work?

我正在尝试在nativeiOS应用程序中自动执行长按触摸操作。方法一:模拟左上角长按,无效。新的TouchAction(driver).longPress(0,0).perform()Appium日志显示没有错误:info:[debug][INST]2015-12-2117:41:19+0000Debug:Gotnewcommand5frominstruments:target.touch([{"touch":[{"x":0,"y":0}],"time":0.2}])info:[debug][INST]2015-12-2117:41:19+0000Debug:evaluatingtar

iphone - 代码/iOS : Storyboard Segue event does not work after adding UIGestureRecognizerDelegate to UIViewController

我有一个简单的Storyboard,其中包含两个场景(SceneA和SceneB)和两个自定义UIViewController实现。SceneA有一个带有到SceneB的segue(模态)按钮。到目前为止它工作得很好:应用程序从SceneA开始,然后按下按钮切换到SceneB。在下一步中,我将添加到ViewController实现中,因为我想在自定义UIViewController实现中检测SceneA上的特定手势(单击/滑动等)。这就是问题所在。在测试中检测到手势并且UI做出相应响应,但是segue不再起作用。我怀疑手势识别器“吞下”了会触发segue的事件,但我不确定如何解决。有没

iphone - MKMapView 设置区域 :Animated: work on simulator but not on device iOS6

我有一个MKMapView。要更改我使用的显示区域[self.mapViewsetRegion:regionanimated:YES];奇怪的是,在模拟器上,区域随着动画发生变化,但在设备上,变化是立即发生的,而不是动画。我在map上长按后更改了区域...这种行为让我发疯,我无法解决它......谢谢... 最佳答案 您需要使用以下代码来降低setRegion的速度[selfperformSelector:@selector(setMapRegion)withObject:nilafterDelay:3.0];-(void)setM