我试图在两个观点之间翻转.这很容易,代码在下面,但我也想同时翻转用于执行翻转的按钮.
当您在播放曲目时,您可以在iPod应用程序中看到此行为; 点击翻盖按钮可以在封面图片和曲目列表之间翻转,但同时会翻转按钮.
这是导航控制器上的一个页面,我要翻转的按钮是rightBarButtonItem.
这是我到目前为止的代码.这会翻转视图,但不会翻转右边的BarButton.
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: 0.5f];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
showingBackside = !showingBackside;
if (showingBackside) {
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft
forView: self.view
cache: YES];
[self.view addSubview: backside.view];
[frontside.view removeFromSuperview];
} else {
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight
forView: self.view
cache: YES];
[self.view addSubview: frontside.view];
[backside.view removeFromSuperview];
}
// flip image, too
NSString *newImage = showingBackside ? @"backside.png" : @"frontside.png";
[(self.navigationItem.rightBarButtonItem) setImage: [UIImage imageNamed: newImage]];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
(此处的图像翻转代码可能无法编译;我在尝试解释我尝试做的事情之后添加了它.)
在我遇到麻烦的地方,我想更改导航控制器中最右边的按钮,以便同时翻转.
我该怎么做呢?我的动画是什么视图,我是作为同一动画块的一部分还是作为单独的动画块执行的?任何提示将不胜感激,我绝对没有很好的处理动画.
我使用导航与自定义UIView子类成为我的titleView.我想确保这是完整的可用宽度.
从逻辑上讲,从我UIViewController的viewWillAppear:,这应该是:
CGFloat width = self.width - self.navigationItem.leftBarButtonItem.width - someConstant;
Run Code Online (Sandbox Code Playgroud)
(我这里没有正确的项目.)
这将适应不同的可能宽度leftBarButtonItem.美中不足的是,leftBarButtonItem是nil,所以leftBarButtonItem.width始终为0(好,在模拟器反正).
backBarButtonItem 也没有.
我应该做什么呢?
iphone uinavigationbar uinavigationcontroller uibarbuttonitem uinavigationitem
将UISearchBar在我的UITableView头部是强烈的色彩.
在TableSearch使用了更细微的代码,但我不知道它是如何做的.我查看了TableSearch示例代码.具体来说,我没有看到tintColor在这个例子中的任何地方使用过.我也没有看到使用不透明度或alpha.
这个TableSearch例子是如何做到的?有人能解释一下吗?
从一个日期到另一个日期循环的最简单方法是什么?
我在概念上想要的是这样的:
for (NSDate *date = [[startDate copy] autorelease]; [date compare: endDate] < 0;
date = [date dateByAddingDays: 1]) {
// do stuff here
}
Run Code Online (Sandbox Code Playgroud)
当然,这不起作用:没有dateByAddingDays:.即使它确实如此,也会留下一大堆自动释放的物体等待它们的毁灭.
这就是我的想法:
NSTimeInterval,因为一天中的秒数可能会有所不同.NSDateComponents一天,然后重新组装它.但这是漫长而丑陋的代码.所以我希望有人为此尝试了一些选择,并找到了一个好的选择.有任何想法吗?
一位同事递给我一部iPhone,它在我们的app运行过程中崩溃了.崩溃报告将崩溃归功于mc_mobile_tunnel而不是我们的应用程序.
Process: mc_mobile_tunnel [7322]
Path: /usr/libexec/mc_mobile_tunnel
Identifier: mc_mobile_tunnel
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-03-24 13:53:15.294 -0700
OS Version: iPhone OS 3.1.3 (7E18)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x304a0b2c 0x30410000 + 592684
1 libSystem.B.dylib 0x304a0b1a 0x30410000 + 592666
2 libSystem.B.dylib 0x304a0b0e 0x30410000 + 592654
3 libSystem.B.dylib 0x304b7e34 0x30410000 + 687668
4 libstdc++.6.dylib 0x34162390 0x340fc000 + 418704
5 libobjc.A.dylib 0x329c0898 0x329b8000 …Run Code Online (Sandbox Code Playgroud) 我已经阅读了一些关于git push打破的解释,但似乎没有一个解决这个问题.
我无法将本地更改推送到远程存储库,即使在拉动并且没有冲突之后也是如此.
$ git pull
Already up-to-date
$ git st
# On branch unstable
nothing to commit (working directory clean)
$ git push
To ssh://<url>
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://<url>'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
<url> 当然是我的存储库的真实URL.
拉动没有变化,没有冲突,我不确定还有什么可能导致失败.
我相信我已经正确设置了所有内容:
$ git remote -v …Run Code Online (Sandbox Code Playgroud) 有没有一种方法可以检查NSCache的内容以进行调试?
这不会在App Store中使用。我只是希望能够在调试时看到其中发生了什么。该description是好看不中用。
代码:
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Run Code Online (Sandbox Code Playgroud)
Apple的文档明确指出:
返回值:即使指定了整数返回类型,此函数也不会返回.当用户通过按Home键终止iPhone应用程序时,应用程序会立即通过调用退出系统函数退出,参数为零.
其次,
int UIApplicationMain (
int argc,
char *argv[],
NSString *principalClassName,
NSString *delegateClassName
);
我们如何从UIApplication子类访问argv?
我有一个使用WebService的应用程序,并做了一些工作,我的问题是,我可以上传相同的应用程序(更改WS链接后),但具有不同的名称?
我宁愿从一些用户那里得到关于垃圾邮件或其他东西的答案,但事实并非如此,这个想法是商业化的,每个客户端(这里的客户端不是iOS用户,它是一个独立的公司)想要购买我的应用程序,将给我他的WS URL,我将只更改WS URL并放置公司的图标和名称,并为他的公司制作一个包,
希望得到帮助.
谢谢,
检查类方法是否由类实现的最简单方法是什么?
例如,UIFont定义了这个方法:
+ (UIFont *)preferredFontForTextStyle:(NSString *)style NS_AVAILABLE_IOS(7_0);
Run Code Online (Sandbox Code Playgroud)
我不能instancesRespondToSelector:在这里使用,因为preferredFontForTextStyle:它不是实例方法而是类方法.
我明白了class_getClassMethod,但是......真的吗?objc/runtime.h?
iphone ×5
ios ×4
app-store ×1
cocoa ×1
cocoa-touch ×1
foundation ×1
git ×1
nscache ×1
nsdate ×1
nsobject ×1
uisearchbar ×1
uitableview ×1