Twitter应用程序是iPhone上的标签栏应用程序.任何选项卡中的任何内容都不会旋转,但是,当您单击推文中的链接时,允许旋转顶部的视图控制器.我曾经唯一的旋转是倾斜设备,风景或肖像,但我不明白如何使用2D变换和动画来旋转视图.
如何使用UIView的子类旋转任何视图?
在我的应用程序中,我使用导航控制器在不同的视图之间切换.我的每个视图都有一个背景图像,但当我从一个视图到另一个视图时,在转换时会在它们之间出现一点点白色.有办法改变吗?
在Table View类中,我在viewDidLoad中有这个:
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"parchment.png"]];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = imageView;
[imageView release];
Run Code Online (Sandbox Code Playgroud)
在详细视图中,我只有HTML的标准加载请求.HTML本身将羊皮纸的代码作为背景图像.这是他们的样子:


但是,从细节视图回到表格视图,我得到了这个:

我正在尝试将倒计时器定时到特定日期.我用:
-(void) viewWillAppear:(BOOL)animated {
NSString *str =@"12/27/2013";
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"MM/dd/yyyy"];
NSDate *date = [formatter dateFromString:str];
NSTimeInterval numberOfSecondsUntilSelectedDate = [date timeIntervalSinceNow];
NSInteger numberOfDays = numberOfSecondsUntilSelectedDate / 86400;
startTime = [[NSDate date] retain];
secondsLeft = numberOfDays;
NSLog(@"number%f", numberOfSecondsUntilSelectedDate);
[self countdownTimer];
}
- (void)updateCounter:(NSTimer *)theTimer {
if(secondsLeft > 0 ){
secondsLeft -- ;
days = secondsLeft / 86400;
NSLog(@"%d", days);
hours = secondsLeft / 3600;
minutes = (secondsLeft % 3600) / 60;
seconds = (secondsLeft %3600) % 60;
myCounterLabel.text …Run Code Online (Sandbox Code Playgroud) 该教程讨论了为字段添加用户名,密码,电子邮件和其他内容,并说您可以更改占位符文本,但没有添加更多字段.
例如,在我的Core _Users数据中,我添加了两列,firstName和lastName.我想为这些添加两个字段.我还需要知道如何确保这些字段适当地传递给数据.有帮助吗?
我试图从一串文本中提取图像的URL.它可能来自不同的网站,可能是任何形式的图像(jpg,png,gif等).什么是扫描字符串,找到任何匹配的图片扩展,并从中获取图形的好方法?
字符串可能是这样的:
Hello, I hope you like my picture located at http://www.website.com/picture1.png. However, if you don't, I know you'll like this one http://www.website2.org/picture2.jpg.Please refer all comments to http://www.website5.com/
Run Code Online (Sandbox Code Playgroud)
我希望能够扫描字符串以查找图像文件的唯一URL,并创建一个新的字符串,无论第一个图像URL是什么.所以在这个字符串中,我可以创建一个只有http://www.website.com/picture1.png的新字符串
我在AppStore中已经有一个使用NSUserDefaults的应用程序.一些默认设置是我在应用首次启动时设置的默认设置,然后允许用户稍后更改它们.所以,在我的AppDelegate appDidFinishLaunchingWithOptions中我放了:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (! [defaults boolForKey:@"notFirstRun"]) {
[defaults setBool:YES forKey:@"notFirstRun"];
[defaults setInteger:0 forKey:@"verseKey"];
[defaults synchronize];
}
Run Code Online (Sandbox Code Playgroud)
我现在遇到的问题是我想在NSUserDefault类别中添加更多默认设置,所以我想让它看起来像这样:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (! [defaults boolForKey:@"notFirstRun"]) {
[defaults setBool:YES forKey:@"notFirstRun"];
NSString *smalltitle = @"4";
NSString *smallarticle = @"3";
[defaults setObject:smalltitle forKey:@"Title"];
[defaults setObject:smallarticle forKey:@"Article"];
[defaults setInteger:0 forKey:@"verseKey"];
[defaults synchronize];
}
Run Code Online (Sandbox Code Playgroud)
我知道这会给那些已经下载了应用程序并且只是更新它的人带来问题.他们不会运行该代码,因为notFirstRun Bool已经设置为YES.关于我应该在这做什么的任何想法?
我有一个NSMutableArray在编辑TableView时经常被编辑.我想要做的是运行检查并查看TableView中的行是否与NSMutableArray中的任何数字匹配,如果相同,则执行操作.所以,在TableView代码中我有:
if([thearray containsObject:indexPath.row] {
//perform action here
}
Run Code Online (Sandbox Code Playgroud)
但是我一直收到错误:
Incompatible integer to pointer conversion sending 'NSInteger' (aka 'int') to parameter of type 'id';
Run Code Online (Sandbox Code Playgroud)
我做错了什么,怎么能这样做?
我试图从我在iOS 7中的appdelegate设置所有导航栏的色调.这总是以前工作,但由于某些原因,现在没有任何变化.在我的appDelegate的didFinishLaunching部分,我有:
[[UINavigationBar appearance] setTintColor:toolbarcolor];
Run Code Online (Sandbox Code Playgroud)
但是,该栏保持默认的半透明选项.
我正在努力在我的应用程序中实现Peek和Pop,以及UIPreviewActions.我的PreviewView都设置好了,Peek和Pop都很棒,我的问题是添加UIPreviewActions.当然,您必须将UIPreviewAction方法放在预览控制器中,那么如何获取它然后关闭该视图,并在其父控制器中打开视图?
我在PreviewController中:
- (NSArray*)previewActionItems {
// setup a list of preview actions
UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"Post to Facebook" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
}];
UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"Message" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
}];
UIPreviewAction *action3 = [UIPreviewAction actionWithTitle:@"Email" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
[self displayComposerSheet];
}];
// add them to an arrary
NSArray *actions = @[action1, action2, action3];
// and return them …Run Code Online (Sandbox Code Playgroud) 在我的Peek视图的视图控制器中我有一个应用程序:
- (NSArray*)previewActionItems {
/
UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"Post to Facebook" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
}];
UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"Message" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
}];
UIPreviewAction *action3 = [UIPreviewAction actionWithTitle:@"Email" style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {
[self displayComposerSheet];
}];
/
NSArray *actions = @[action1, action2, action3];
/
return actions;
}
Run Code Online (Sandbox Code Playgroud)
这成功地允许我在3D Touch之后拉出一张预览动作.displayComposerSheet是:
-(void)displayComposerSheet
{
NSLog(@"Mail Button Pressed");
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] …Run Code Online (Sandbox Code Playgroud) ios ×9
xcode ×3
3dtouch ×2
mfmailcomposeviewcontroller ×2
appdelegate ×1
cocoa-touch ×1
countdown ×1
image ×1
ios7 ×1
iphone ×1
nsdate ×1
nsstring ×1
nstimer ×1
objective-c ×1
range ×1
tintcolor ×1
transition ×1
uitableview ×1
url ×1