我有一个UIView,我在其中安排了UIButtons.我想找到那些UIButton的位置.
我知道buttons.frame会给我这些职位,但只会就其直接的超级视图给我立场.
有没有办法我们可以找到这些按钮的位置,与UIButton superview的超级视图有关?
例如,假设UIView名为"firstView".
然后,我有另一个UIView,"secondView".这个"SecondView"是"firstView"的子视图.
然后我将UIButton作为"secondView"的子视图.
->UIViewController.view
--->FirstView A
------->SecondView B
------------>Button
Run Code Online (Sandbox Code Playgroud)
现在,有没有什么方法可以找到UIButton的位置,就"firstView"而言?
我不小心删除了AVFoundation,CoreFoundation,Foundation和UIKit.framework,CoreGraphics.frameworks框架构成了我的Xcode.有没有办法恢复它们..或者我将不得不重新安装Xcode.
我试图删除网址的最后一部分,它是一个FTP URL.
假设我有一个URL:> ftp://ftp.abc.com/public_html/somefolder/.删除最后一部分后,我应该将其作为:ftp://ftp.abc.com/public_html/.
我尝试使用stringByDeletingLastPathComponenet和URLByDeletingLastPathComponent,但他们没有正确删除最后一部分.它们会改变网址的整体外观.
例如,在使用上述方法之后,这里是我得到的URL格式:ftp:/ftp.abc.com/public_html/.它会删除"ftp://"中的一个"/",这会导致我的程序崩溃.
如何在不干扰URL其余部分的情况下删除最后一部分?
更新:
NSURL * stringUrl = [NSURL URLWithString:string];
NSURL * urlByRemovingLastComponent = [stringUrl URLByDeletingLastPathComponent];
NSLog(@"%@", urlByRemovingLastComponent);
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,我得到的输出为: - ftp:/ftp.abc.com/public_html/
我想知道在iOS 6上使用谷歌地图是否完全不可能?
我准备了一个应用程序,现在当我使用iOS 6时,它会自动获取Apple地图!
由于我不想使用Apple地图,所以我想知道是否有任何方法,是否可以在iOS 6上使用Google地图!
我正在开发一款游戏,其中我试图点击两种不同的类型,如果分别点击单击和双击.
继承人我在触摸开始的方法:
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for( UITouch *touch in touches )
{
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
NSLog(@"TOUCH LOCATION IN TOUCH BEGAN = (%f , %f)", location.x , location.y);
NSUInteger tapCount = [touch tapCount];
switch (tapCount)
{
case 1:
{
NSDictionary * touchloc = [NSDictionary dictionaryWithObject:[NSValue valueWithCGPoint:location] forKey:@"location"];
[self performSelector:@selector(startTimer:) withObject:touchloc afterDelay:3];
break;
}
case 2:
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startTimer) object:nil];
[self performSelector:@selector(removeBall) withObject:nil afterDelay:1];
break;
}
default:
{ …Run Code Online (Sandbox Code Playgroud) 我试图一个接一个地关闭两个视图控制器,在我的第一个视图控制器中,我一直保持上传功能,当完成当前视图控制器时,它被解除.
现在,在上传ViewController被解雇之后,我来到了之前的viewcontroller.我想解雇那个"previousViewController".
解除"uploadViewController"后,我在"PreviousViewController"上调用方法
以下是我尝试这样做的方法:
在UploadViewController中:
[self dismissViewControllerAnimated:YES completion:^{
[previousView dismissME];
}];
Run Code Online (Sandbox Code Playgroud)
现在,当我来到"PreviousViewController"
这是dismissME方法:
-(void)dismissME {
if (![[self presentingViewController] isBeingDismissed]) {
NSLog(@"Dismiss ME");
[self dismissViewControllerAnimated:YES completion:NULL];
}
}
Run Code Online (Sandbox Code Playgroud)
我得到了"Dismiss ME"日志,但是viewController没有被解雇.
有任何想法吗 .. ?怎么实现这个..?
iphone ×5
ios6 ×3
ios ×2
cgpoint ×1
cgrect ×1
frameworks ×1
ftp ×1
google-maps ×1
ios5 ×1
ios6-maps ×1
nsdictionary ×1
nsstring ×1
nsurl ×1
objective-c ×1
uibutton ×1
uiview ×1
xcode ×1