小编Bru*_*uno的帖子

如何在iOS中点击缩放和双击缩小?

我正在开发一个应用程序来显示一个UIImages使用a 的画廊UIScrollView,我的问题是,如何点击zoom并双击zoom,如何处理时它是如何工作的UIScrollView.

objective-c uiscrollview ios uitapgesturerecognizer

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

UITableView控件上的不同行为

有这种控制,我真的很感激:github上链接的问题是,我现在有一个情况,当我需要打开一行和所有以前的应关闭,我只能有一个开行的时间.

由于我对xcode不是很熟悉,我需要一些关于我应该从哪里开始的信息以及使代码按照我现在需要的方式工作的必要步骤.

我设法做了一些测试,但不是一个可行的解决方案,这就是我现在所拥有的:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    NSInteger row = indexPath.row;

    if (indexPath.section == 0) {

        NSLog(@"indexPath1 = %i", selectedRow);

        NSDictionary *d = [self.firstForTable objectAtIndex:indexPath.row];

        if([d valueForKey:@"Objects"]) {
            NSArray *ar = [d valueForKey:@"Objects"];

            NSUInteger count = indexPath.row +1;
            NSMutableArray *arCells = [NSMutableArray array];

            for(NSDictionary *dInner in ar ) {
                [arCells addObject:[NSIndexPath indexPathForRow:count inSection:0]];
                [self.firstForTable insertObject:dInner atIndex:count++];
            }

            [tableView insertRowsAtIndexPaths:arCells withRowAnimation:UITableViewRowAnimationLeft];
        }
        else {
            NSLog(@"Leave Element:::%@ %@|",[d valueForKey:@"name"],[d valueForKey:@"book"]);
        }

        if (selectedRow == row) …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

8
推荐指数
2
解决办法
606
查看次数

未选择"设置"控件

我有一个问题,我希望我的UISegment控件在应用加载时启动所有未选中状态.

如果有人可以帮助解决这个问题,我会非常感激.

最好的祝福.

iphone xcode objective-c ios

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

获取现有UILocalNotifications的列表并修改其日期

我正在尝试安排几个UILocalNotification,我需要访问已经创建的通知.

是否可以UILocalNotification创建所有s 的列表/数组?我可以编辑现有本地通知的开火日期吗?

这是我用于创建本地通知的代码:

 UILocalNotification* localNotification = [[UILocalNotification alloc] init];
 localNotification.fireDate = pickerDate;
 localNotification.alertBody = textFieldName.text;
 localNotification.alertAction = @"Item date expired!";
 localNotification.timeZone = [NSTimeZone defaultTimeZone];
 localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c ios uilocalnotification

5
推荐指数
2
解决办法
5347
查看次数

使用PUT上传Alamofire图像

我目前正在尝试使用预先签名的网址将图片上传到亚马逊.

它的工作方式是,我发出一个GET请求来获取预签名的URL,而不是PUT请求通过使用从GET请求返回的URL来上传图像.

这两个规则是:Content-Type需要是image\jpeg,http方法必须是PUT.

所以,目前我的上传代码返回200但亚马逊拒绝数据.

这是我的代码:

为上传返回的实际网址是:https://mimik-apps-channel.s3-us-west-2.amazonaws.com/profiles/2312528782074206653.jpg?X-Amz-Expires=3600&X-Amz-Algorithm=AWS4 -HMAC-SHA256&X-AMZ-凭证= AKIAJ36SCZW7WGBAW7CQ/20170202/US-西-2/S3/aws4_request&X-AMZ-日期= 20170202T102202Z&X-AMZ-SignedHeaders =宿主&X-AMZ-签名= 007ad8694fe1ed83b08d4890f17b9985e169f7ab8fcd7b0d648a383c69ebc748

                    var headers = Alamofire.SessionManager.defaultHTTPHeaders
                    headers["Content-Type"] = "image/jpeg"
                    let URL = try! URLRequest(url: url, method: .put, headers: headers)

                    Alamofire.upload(multipartFormData: { (multipartFormData) in
                        let compressionQuality: CGFloat = 0.8
                        guard let imageData = UIImageJPEGRepresentation(image, compressionQuality) else {
                            print("Unable to get JPEG representation for image \(image)")

                            return
                        }

                        multipartFormData.append(imageData, withName: "image.jpg", mimeType: "image/jpeg")
                        // code
                    }, with: URL, encodingCompletion: { (result) in
                        switch result {
                        case .success(let upload, _, _): …
Run Code Online (Sandbox Code Playgroud)

image amazon-s3 amazon-web-services ios alamofire

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

返回时出现内存泄漏警告

我正在处理一个旧代码,我有这个警告消息:按值传递的struct参数包含未初始化的数据(例如,通过字段链:'origin.x').如果我能获得圆顶帮助,我会非常感激:)

我正在使用的代码:

- (void)positionScroller
{
    CGRect screenFrame = [[UIScreen mainScreen] bounds];
    CGRect scrollerRect;

    if( self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown )
    {
        scrollerRect = CGRectMake( 0, 0, screenFrame.size.width, screenFrame.size.height );
    }
    else if( self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight )
    {
        scrollerRect = CGRectMake( 0, 0, screenFrame.size.height, screenFrame.size.width );
    }

    _scroller.frame = scrollerRect;   <---This is where the compiler gives the warning
}
Run Code Online (Sandbox Code Playgroud)

最好的祝福.

xcode objective-c ios

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

从字符串中检索图像URL

我正在解析一个xml文件,我可以NSLog解析,但我的问题是我需要从这个"字符串"获取图像url!

<p>
 <a href="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex43.jpg"><img class="alignnone size-thumbnail wp-image-81" title="ex4" src="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex43-150x150.jpg" alt="" width="150" height="150" /></a>
 <a href="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex32.jpg"><img class="alignnone size-thumbnail wp-image-80" title="ex3" src="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex32-150x150.jpg" alt="" width="150" height="150" /></a>
 <a href="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex23.jpg"><img class="alignnone size-thumbnail wp-image-79" title="ex2" src="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex23-150x150.jpg" alt="" width="150" height="150" /></a>
 <a href="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex12.jpg"><img class="alignnone size-thumbnail wp-image-71" title="ex1" src="http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/2012/02/ex12-150x150.jpg" alt="" width="150" height="150" /></a>
 </p>
Run Code Online (Sandbox Code Playgroud)

对不起普通代码:)

我用来提取网址的是这段代码,但它不起作用:

   NSRange start = [item.imageGallery       rangeOfString:@"http://www.bubblesurprise.com/WPRESS_APP/wp-content/uploads/"];
    NSRange end = [item.imageGallery rangeOfString:@"\" "];

    int rangeLength = (int)(end.location - start.location);

    NSString *hrefString = [[NSString alloc] initWithString:[item.imageGallery substringWithRange:NSMakeRange(start.location, rangeLength)]];
    NSLog(@"image url = %@",hrefString);
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

用RxSwift循环

我是Reactive Programming的新手,我有一个我不能独自解决的大问题...我需要按顺序上传几个视频资产,但我不知道该怎么做,我有很多PHAssets,我正在尝试遍历每个元素并通过网络发送它。到目前为止,这是我的代码并带有注释:

for item in items {
                    let fileName = item.media.localIdentifier

                    //Observable to generate local url to be used to save the compressed video
                    let compressedVideoOutputUrl = videoHelper.getDocumentsURL().appendingPathComponent(fileName)

                    //Observable to generate a thumbnail image for the video
                    let thumbnailObservable =  videoHelper.getBase64Thumbnail(myItem: item)

                    //Observable to request the video from the iPhone library
                    let videoObservable = videoHelper.requestVideo(myItem: item)

                        //Compress the video and save it on the previously generated local url
                        .flatMap { videoHelper.compressVideo(inputURL: $0, outputURL: compressedVideoOutputUrl) }
                    //Generate the thumbnail and share …
Run Code Online (Sandbox Code Playgroud)

reactive-programming ios swift rx-swift

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