众所周知UINavigationController从左到右推送ViewController,有没有办法将视图从右推到左?喜欢后退按钮的动画.
现在我有这个:
[self.navigationController pushViewController:viewController animated:YES];
Run Code Online (Sandbox Code Playgroud) 当我使用包中的路径创建图像时,这就是我正在做的事情:
UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"jpg"]];
Run Code Online (Sandbox Code Playgroud)
我想要做的是尝试找到我的图像的路径,但不使用扩展名,而不使用'ofType'(因为我的图像的名称和她的扩展名存储在我的数据库中)类似的东西:
UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image.jpg"]];
Run Code Online (Sandbox Code Playgroud)
但我不知道该怎么做.
最好的祝福,
Iphone上的UITextField的ResignFirstResponder semms不能用于Ipad.如何以编程方式解除键盘?
谢谢,
我有一个NSMutableArray,我想在其中插入数据,问题是我首先要检查我插入数据的索引是否存在.怎么做?我尝试类似的东西,但没有任何工作:
if ([[eventArray objectAtIndex:j] count] == 0)
Run Code Online (Sandbox Code Playgroud)
要么
if (![eventArray objectAtIndex:j])
Run Code Online (Sandbox Code Playgroud) 在我的ViewDidLoad中,我尝试了类似的东西,但它不起作用:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10,2,60,14)];
label.autoresizingMask = UIViewAutoresisingFlecibleWidth;
[self.navigationController.navigationBar addSubview:label];
Run Code Online (Sandbox Code Playgroud)
我想在NavigationBar的左侧部分显示一个标签.或者可能更改navigationBar.title位置
谢谢,
我正在尝试制作翻转时钟动画,我发现本教程非常有趣 http://www.voyce.com/index.php/2010/04/10/creating-an-ipad-flip-clock-with-核心动画/ 但我仍然无法使它工作.如果有人这样做并且可以分享经验甚至是非常好的代码源.
谢谢,
PS:如果您有其他教程链接,请分享.
我在我的应用程序中使用MapKit并且使用了用户位置
[mapview setShowUserLocation:YES];
Run Code Online (Sandbox Code Playgroud)
我想用userLocation的坐标设置region.center.latitude和region.center.longitude,怎么做?
我在AppDelegate中创建了一个视图,我将其添加到窗口中:
[window addSubview:myView];Run Code Online (Sandbox Code Playgroud)我希望每次回到这个视图时都能检查设备方向,所以我可以对它进行一些修改.我怎么能在appDelegate中做到这一点? 我尝试在没有Nib的UIWebView中显示一个简单的网页.问题是,当我点击我的buttun时,会出现一个新的页面空白页面,但没有显示任何内容.我错过了什么?
- (void)loadView {
UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
self.webView = web;
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [[[NSURL alloc] initWithString:urlAddress] autorelease];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[topView addSubview:self.webView];
[web release];
}
谢谢,
我有一个简单的动画,只需修改按钮的位置:
[UIView beginAnimation:nil context:nil];
[UIView setAnimationsDuration:3.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
mybutton.frame = CGREctMake(20, 233, 280, 46);
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
当这个完成时,我想要执行一些其他动画,怎么做?
我看到任何有关可达性的帖子,但人们并没有真正给出问题的确切答案.在我的应用程序中,我使用来自apple的Reachability代码,在我的appDelegate中,我使用:
-(BOOL)checkInternet {
Reachability *reachability = [Reachability reachabilityWithHostName:@"www.google.com"];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
BOOL internet;
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) {
internet = NO;
}else {
internet = YES;
}
return internet;
}
Run Code Online (Sandbox Code Playgroud)
所以问题是即使我有互联网连接,这段代码告诉我,我没有.有谁知道该怎么做才能使这个工作?
谢谢,
我有一个我在UIImageView上添加的按钮.使用用户触摸屏幕时UIImageView将旋转的方法,我想知道旋转完成后是否有办法获取按钮的新位置.
现在我用这种方法一直得到原始位置:
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Xposition : %f", myButton.frame.origin.x);
NSLog(@"Yposition : %f", myButton.frame.origin.y);
}
Run Code Online (Sandbox Code Playgroud)
谢谢,
objective-c ×12
iphone ×11
ipad ×3
cocoa ×1
cocoa-touch ×1
mapkit ×1
reachability ×1
uikeyboard ×1
uiwebview ×1