小编Des*_*ond的帖子

如何将2个图像合并/合并为1个

想知道该怎么做将2张图片保存到1张图片中.

其中一张照片允许移动,旋转和放大/缩小...

我这样做,但它基本上捕获了屏幕上的所有内容,包括我的按钮......

UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *savedImg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)

iphone xcode uiimageview uiimage ios

31
推荐指数
5
解决办法
4万
查看次数

如何在iOS 5中更改UITabBarItem中的文本颜色

在iOS 5中具有更多外观控制,我们如何更改UITabBarItem文本颜色?从默认白色到其他颜色?

编辑:工作解决方案

  [[UITabBarItem appearance] setTitleTextAttributes:
         [NSDictionary dictionaryWithObjectsAndKeys:
          [UIColor blackColor], UITextAttributeTextColor, 
          [UIColor whiteColor], UITextAttributeTextShadowColor, 
          [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, 
          [UIFont fontWithName:@"Rok" size:0.0], UITextAttributeFont, 
          nil] 
                                              forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

iphone xcode uitabbarcontroller uitabbar ios

27
推荐指数
3
解决办法
3万
查看次数

如何发送异步URL请求?

我想知道如何仅从URL请求异步获取返回值1或0 ....

目前我是这样做的:

NSString *UTCString = [NSString stringWithFormat:@"http://web.blah.net/question/CheckQuestions?utc=%0.f",[lastUTCDate timeIntervalSince1970]];
NSLog(@"UTC String %@",UTCString);
NSURL *updateDataURL = [NSURL URLWithString:UTCString];
NSString *checkValue = [NSString stringWithContentsOfURL:updateDataURL encoding:NSASCIIStringEncoding error:Nil];
NSLog(@"check Value %@",checkValue);
Run Code Online (Sandbox Code Playgroud)

这是有效的,但是它阻止了我的主线程,直到我从URL得到回复,我该如何设置它以便它将在另一个线程而不是主线程中执行?

编辑:ANSWER 我最终用这个来调用我的功能,它运行良好:)

[self performSelectorInBackground:@selector(shouldCheckForUpdate) withObject:nil];
Run Code Online (Sandbox Code Playgroud)

iphone xcode nsurlconnection nsurlrequest ios

21
推荐指数
3
解决办法
5万
查看次数

iPhone OpenCV教程在形状识别方面的应用

我想做一些iPhone OpenCV应用程序来识别简单的形状,如通过相机的方形.

任何人都可以给我一个简单的教程吗?

c c++ opencv image-processing ios

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

删除最后一条记录时UITableView deleteRowsAtIndexPath崩溃

当我从a中删除最后一条记录时遇到以下错误UITableView.

由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无效更新:第0节中的行数无效.更新后的现有部分中包含的行数(3)必须等于该行中包含的行数在更新(1)之前的部分,加上或减去从该部分插入或删除的行数(插入1个,删除1个)并加上或减去移入或移出该部分的行数(0移入,0移动)出)."

如果表数组为空,我的目标是显示"No Record found".

这是我正在使用的代码.当我从表数组中删除最后一条记录时,应用程序崩溃了.如何重新加载表并显示"No Record Found"标签?

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if ([idArray count]==0) {
        return  3;
    }
    else 
    {
        return [idArray count];
    }   
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    NSLog(@"array count %d",[idArray count]);
    if ([idArray count] == 0) {
        static NSString *CellIdentifier = @"Cell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview ios

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

隐藏删除按钮时,自定义uitableviewcell内容不动画

我想知道我错过了什么,因为我的单元格在隐藏删除按钮时没有动画.删除按钮完成动画之前,标签会跳回原始位置.

当我点击圆形编辑视图以显示删除按钮时,标签动画有效:

删除按钮出现的单元格的屏幕截图

但是,当我再次点击它以隐藏删除按钮时,标签的移动不会动画:

删除按钮消失的单元格的屏幕截图

注意:这些屏幕截图不是从以下代码创建的.但他们表明了这个问题.

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    homeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[homeCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    // Set up the cell
    Consumed *drinkObj = [self.appDelegate.consumedDrinksArray objectAtIndex:indexPath.row];        
    cell.titleLabel.text = drinkObj.drinkName;
    NSString *detailTextTime = [NSDate stringFromDate:drinkObj.dateConsumed withFormat:@"h:mma"];

    NSString *detailTextrelative = [relativeDateTransformer transformedValue:drinkObj.dateConsumed];

    NSString *detailText =  [NSString stringWithFormat:@"%@ %@ ", detailTextTime,detailTextrelative];
    cell.timeLabel.text = detailText;

    cell.stdDLabel.text = @"999.0"; //[NSString …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch uitableview ios

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

如何添加uiimagepickerview自定义叠加层

我想在UIImagepickerview上添加一些自定义叠加层和一些自定义按钮.

如果有人能给我看一个链接或教程2,我将不胜感激.

谢谢

iphone xcode overlay uiimagepickercontroller ios

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

如何将UIImage和UILabel组合成一个图像并保存

我有2个UILabel和2个图像,我需要合并到一个UIImage中进行保存.

我知道我可以用屏幕截图来做,但是我的主要图像是圆形的,所以如果我将其缩小,它仍然会显示出锐利的边缘.

我可以这样做来组合图像:

//CGSize newImageSize = CGSizeMake(cropImage.frame.size.width, cropImage.frame.size.height);
CGSize newImageSize = CGSizeMake(480, 320);
NSLog(@"CGSize %@",NSStringFromCGSize(newImageSize));

UIGraphicsBeginImageContextWithOptions(newImageSize, NO, 0.0); //retina res
[self.viewForImg.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

NSData *imgData =  UIImageJPEGRepresentation(image, 0.9); //UIImagePNGRepresentation ( image ); // get JPEG representation
UIImage * imagePNG = [UIImage imageWithData:imgData]; // wrap UIImage around PNG representation

UIGraphicsEndImageContext();
return imagePNG;
Run Code Online (Sandbox Code Playgroud)

但不知道如何添加UILabel.

任何回复都非常感谢.

iphone xcode uiimageview uiimage ios

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

如何在控制中心显示寻道轨迹持续时间

如何将歌曲名称和曲目持续时间等歌曲信息传递给控制中心.播放器播放音乐很好,播放和暂停控制工作正常.

玩苹果的音乐应用程序

在此输入图像描述 在此输入图像描述

使用下面的代码玩我的应用程序,如何传递歌曲信息以显示它?

在此输入图像描述 在此输入图像描述

//AppDelegate
    -(void)setupAudio
    {
        // Set AVAudioSession
        NSError *sessionError = nil;
        [[AVAudioSession sharedInstance] setDelegate:self];
        [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&sessionError];

        // Change the default output audio route
        UInt32 doChangeDefaultRoute = 1;
        AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
                                sizeof(doChangeDefaultRoute), &doChangeDefaultRoute);

            [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
            [self becomeFirstResponder];
    }

    //Make sure we can recieve remote control events
    - (BOOL)canBecomeFirstResponder {
        return YES;
    }

    - (void)remoteControlReceivedWithEvent:(UIEvent *)event
    {
        //if it is a remote control event handle it correctly
        if (event.type == UIEventTypeRemoteControl) {
            if (event.subtype == UIEventSubtypeRemoteControlPlay)
            {
                NSLog(@"UIEventSubtypeRemoteControlPlay");
                [[AppMusicPlayer …
Run Code Online (Sandbox Code Playgroud)

objective-c avaudioplayer ios avaudiosession control-center

10
推荐指数
2
解决办法
8907
查看次数

OpenSSL标头版本!=影响APNS的HTTP/2的OpenSSL库版本

我在openSSL上有这个奇怪的组合.

我的命令提示符openssl version返回库版本 - > OpenSSL 1.0.2h 2016年5月3日

我的php curl调用 - > echo "openssl version text: " . OPENSSL_VERSION_TEXT . "\n";返回标题版本:openssl版本文本:OpenSSL 1.0.1t 2016年5月3日

我想知道如何更新OpenSSL Header版本,因为我需要1.0.2才能让APNS正常工作,因为我还在

HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 504f5354202f332f6465766963652f613433646466376235

我正在使用WAMP Apache/2.4.17(Win64)PHP/5.6.16

在此输入图像描述

php apache curl openssl wamp

10
推荐指数
2
解决办法
1193
查看次数