小编use*_*452的帖子

如何旋转UIViews?

Twitter应用程序是iPhone上的标签栏应用程序.任何选项卡中的任何内容都不会旋转,但是,当您单击推文中的链接时,允许旋转顶部的视图控制器.我曾经唯一的旋转是倾斜设备,风景或肖像,但我不明白如何使用2D变换和动画来旋转视图.

如何使用UIView的子类旋转任何视图?

iphone xcode cocoa-touch core-animation ios

2
推荐指数
1
解决办法
1万
查看次数

推送视图时改变iOS应用程序的背景颜色

在我的应用程序中,我使用导航控制器在不同的视图之间切换.我的每个视图都有一个背景图像,但当我从一个视图到另一个视图时,在转换时会在它们之间出现一点点白色.有办法改变吗?

在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本身将羊皮纸的代码作为背景图像.这是他们的样子:

在此输入图像描述

在此输入图像描述

但是,从细节视图回到表格视图,我得到了这个: 在此输入图像描述

xcode transition image pushviewcontroller ios

2
推荐指数
1
解决办法
1万
查看次数

iOS倒计时器到特定日期

我正在尝试将倒计时器定时到特定日期.我用:

-(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)

nsdate nstimer countdown ios

2
推荐指数
1
解决办法
3819
查看次数

在Parse上向SignUpViewController添加多个字段

该教程讨论了为字段添加用户名,密码,电子邮件和其他内容,并说您可以更改占位符文本,但没有添加更多字段.

例如,在我的Core _Users数据中,我添加了两列,firstName和lastName.我想为这些添加两个字段.我还需要知道如何确保这些字段适当地传递给数据.有帮助吗?

ios parse-platform

2
推荐指数
1
解决办法
563
查看次数

从字符串中提取图像的URL

我试图从一串文本中提取图像的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的新字符串

url range nsstring ios

1
推荐指数
1
解决办法
735
查看次数

NSUserDefaults重置首次运行

我在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.关于我应该在这做什么的任何想法?

objective-c nsuserdefaults ios appdelegate

1
推荐指数
1
解决办法
810
查看次数

将NSMutableArray中的数字与indexPath.row进行比较

我有一个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)

我做错了什么,怎么能这样做?

xcode uitableview nsmutablearray ios

1
推荐指数
1
解决办法
1533
查看次数

在iOS 7中设置NavigationBar Tint Color

我试图从我在iOS 7中的appdelegate设置所有导航栏的色调.这总是以前工作,但由于某些原因,现在没有任何变化.在我的appDelegate的didFinishLaunching部分,我有:

[[UINavigationBar appearance] setTintColor:toolbarcolor];
Run Code Online (Sandbox Code Playgroud)

但是,该栏保持默认的半透明选项.

uinavigationbar tintcolor ios7

1
推荐指数
1
解决办法
9298
查看次数

来自Peek的UIPreviewAction邮件

我正在努力在我的应用程序中实现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)

ios 3dtouch mfmailcomposeviewcontroller

1
推荐指数
1
解决办法
596
查看次数

Mail Composer无法从UIPreviewAction启动

在我的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)

uiviewcontroller ios 3dtouch mfmailcomposeviewcontroller

1
推荐指数
1
解决办法
556
查看次数