小编Mor*_*s78的帖子

在iPhone 5s iOS 8.1.2和模拟器8.1上找不到支持4型和5型的键盘

我在带有iOS v8.1.2的iPhone 5s上收到Xcode控制台中的以下消息:

  • 键盘iPhone-Portrait-NumberPad找不到支持类型4的键盘; 使用3876877096_Portrait_iPhone-Simple-Pad_Default
  • 找不到支持键盘iPhone-Portrait-PhonePad的5型键盘; 使用2870935746_Portrait_iPhone-Complex-Pad_Default

有人知道出了什么问题吗?键盘按预期显示.同样适用于iOS模拟器v8.1.我只是想摆脱这些警告.

谢谢

keyboard objective-c ios xcode6

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

如何在目标c中使用泛型类的swift类

我有以下带有NumericType T的swift类.

@objc class MathStatistics<T: NumericType> : NSObject {
        var numbers = [T]()

        func sum() -> T? {
            if numbers.count == 0 {
                return nil
            }

            var sum = T(0)

            for value in numbers {
                sum = sum + value
            }
            return sum
        }
    }
Run Code Online (Sandbox Code Playgroud)

在swift中,初始化类对象如下:

let statistics = MathStatistics<Double>()
Run Code Online (Sandbox Code Playgroud)

如何在Objective C中初始化相同的对象?以下行未设置数字类型T.

MathStatistics *stats = [[MathStatistics alloc] init];
Run Code Online (Sandbox Code Playgroud)

generics objective-c swift

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

UIInputViewAudioFeedback协议的问题(enableInputClicksWhenVisible未调用)

我的自定义键盘和播放"咔嗒"声音有些问题.我正在使用以下课程和定义.

KeyboardShotInputView.h

#import <UIKit/UIKit.h>

//------------------------------------------------------------------------------
// Protocol defintion
//------------------------------------------------------------------------------

@protocol KeyboardShotInputDelegate

- (void)shotButtonDidTouchDown:(NSString*)value;
- (void)deleteButtonDidTouchDown;

@end

//------------------------------------------------------------------------------
// Interface defintition
//------------------------------------------------------------------------------

@interface KeyboardShotInputView : UIView <UIInputViewAudioFeedback>

@property (nonatomic, strong) id <KeyboardShotInputDelegate> delegate;
@property (strong, nonatomic) IBOutlet UIView *keyboard;
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *shotButtonCollection;
@property (weak, nonatomic) IBOutlet UIButton *deleteButton;

- (UIView *) getKeyboardView;
- (IBAction)shotButtonPressed:(id)sender;
- (IBAction)deleteButtonPressed:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)

KeyboardShotInputView.m

#import "KeyboardShotInputView.h"

@implementation KeyboardShotInputView

@synthesize keyboard;
@synthesize shotButtonCollection;
@synthesize deleteButton;

//------------------------------------------------------------------------------

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];

    if (self) …
Run Code Online (Sandbox Code Playgroud)

protocols objective-c ios

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

如何使用最小值,最大值和网格线之间的固定步长来设置iso-charts的y轴?

我刚刚进入使用ios-charts的学习阶段.我喜欢将x轴网格更改为固定值.我绘制的y值只是int数字,如1,2,3,...,10.然而,左侧y轴显示的值如6.3,9.1等,具体取决于我的缩放级别.第二个问题是,如何设置x轴以显示标签1,5,10,15,.... 40?

有没有办法影响步长,例如在Excel中?

// zoom y-axis to min/max value
lineChart.leftAxis.customAxisMin = max(0.0, lineChart.data!.yMin - 1.0)
lineChart.leftAxis.customAxisMax = min(10.0, lineChart.data!.yMax + 1.0)
lineChart.leftAxis.startAtZeroEnabled = false
Run Code Online (Sandbox Code Playgroud)

图表(最小= 6.0和最大= 10.0):

网格以6.3而不是6.0开始. 在此输入图像描述 图表(min = 7.0和max = 10.0):

网格以7.0的预期开始. 在此输入图像描述

这里出了什么问题?

swift ios-charts

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

在核心数据中保存UIImages的最佳方法

我正在寻找在一个核心数据对象中存储多个图像的最佳方法.我试图直接在Core Data中存储UIImage对象.工作良好!

不过,我在一些论坛中读到将UIImage数据转换为PNG并将其存储为二进制数据.在我的iPhone 5s上,这非常慢.

优缺点都有什么?还有其他解决方案吗?

谢谢!

core-data objective-c uiimage ios7.1

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

等待信号量完成writeImageToSavedPhotosAlbum的块

在我的应用程序中,我通过选择器打开相机,拍完照片后,我想通过以下方法保护资产库.调用writeImageToSavedPhotosAlbum后,该方法会冻结.

没有信号量,方法可以完美地工作.但是我没想到会收到assetURL.

+ (NSURL*)safeImageToAssetsLibrary:(UIImage *)image metadata:(NSDictionary *)metadata
{
    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
    __block NSURL *retAssestURL = nil;

    dispatch_semaphore_t semaWaitingForSafeImage = dispatch_semaphore_create(0);
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

    // safe the image to the assests library
    NSLog(@"Safe image to asssets library...");

    dispatch_async(queue, ^{
        [library writeImageToSavedPhotosAlbum:image.CGImage metadata:metadata completionBlock:^(NSURL *assetURL, NSError *error) {

            if (error) {
                NSLog(@"Image could not be safed to the assets library: %@", error);
                retAssestURL = nil;
            }
            else {
                NSLog( @"Image safed successfully to assetURL: %@", assetURL);
                retAssestURL …
Run Code Online (Sandbox Code Playgroud)

semaphore objective-c alassetslibrary ios7

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