小编War*_*olf的帖子

如何管理UIImageView内容模式?

我有一个UIImageView有一些固定的矩形.但我的图像尺寸不固定.我想根据UIImageView的rect大小显示图像.无论图像的分辨率是大还是大,它都必须根据UIImageView的大小固定显示.我很困惑使用以下资产.

UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit,
UIViewContentModeScaleAspectFill,
UIViewContentModeRedraw
Run Code Online (Sandbox Code Playgroud)

在autoresize mask中设置什么?他们的表现如何?

iphone uiimageview ipad ios

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

G + sdk给出登录错误?

我已经实施了Google Plus Api并在网站上提供了登录信息.但是点击"允许访问"后登录后出现问题,如下所示:

在此输入图像描述

出现以下消息:

在此输入图像描述

我的代码如下,请告诉我如果还有什么:

    - (void)viewDidLoad
{
 self.signInButton.delegate = self;
 self.signInButton.clientID = kClientId;
 self.signInButton.scope = [NSArray arrayWithObjects:
                            @"https://www.googleapis.com/auth/plus.me",
                            nil];

 SLNetworkAppDelegate *appDelegate = (SLNetworkAppDelegate*)
 [[UIApplication sharedApplication] delegate];
 appDelegate.signInButton = self.signInButton;

 share =[[GPPShare alloc] initWithClientID:kClientId];
 share.delegate = self; // optional
 appDelegate.share=share;

    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (IBAction) didTapShare: (id)sender {
 [[[[share shareDialog]
    setURLToShare:[NSURL URLWithString:@"https://developers.google.com/+/mobile/ios/getting-started"]]
   setPrefillText:@"testing share via google plus"] open];

 // Or, without a URL or prefill …
Run Code Online (Sandbox Code Playgroud)

ios google-plus

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

ld:找不到-lGoogleToolboxForMac的库

我正在通过pod实现firebase设置.

我的Pods文件看起来像是一个.

# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'
# $(PROJECT_DIR)/build/Debug-iphoneos/GoogleToolboxForMac lib search path
target 'ProductName' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for mCura

pod 'Firebase/Core'
pod 'Firebase/Messaging'

end
Run Code Online (Sandbox Code Playgroud)

iPad模拟器一切都很好.它的运行,但当我在iDevice中运行我的应用程序.它显示找不到库.

ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我已经浪费了2天来消除这个错误并尝试了我能在网上找到的一切.GoogleToolboxForMac安装firebase pod时,库会自动安装.

objective-c google-toolbox-for-mac firebase-cloud-messaging xcode8.1

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

是否可以在UITableViewSectionIndex中包装单词?

我想在UItableView的右侧显示部分索引中的单词.

问题是,如果字长增加,节索引宽度也增加,表视图单元格内容视图大小减小.我不想显示节索引数组对象的子字符串.因为我想在节中显示整个单词必须包装它.

-(NSArray*) sectionIndexTitlesForTableView:(UITableView *)tableView
{
    NSMutableArray *array = [[NSMutableArray alloc] init];

    for (int i = 0; i <[keys count]; i++) {
        NSString *str = [self.keys objectAtIndex:i];
           [array addObject:str];
    }

    NSArray *a =[NSArray arrayWithArray:array];
    [array release];
    return a;
}
Run Code Online (Sandbox Code Playgroud)

数组中的对象返回sectionIndextitle方法是冗长的,我想包装该单词.

谁知道怎么做?

在此输入图像描述

iphone objective-c uitableview ios

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

NSMutableURLRequest setTimeoutInterval在ios 11.0中不起作用

我正在使用URL后台会话将pdf上传作为数据流,使用ios版本> 9.0.我将超时间隔设置为300秒.它根本不起作用.10秒后,它会出现超时错误.

下面给出了一段代码

  NSTimeInterval reqTimeInterval = 300.0f;

- (NSURLSession *)uploadSessionForMrNo:(NSString *)mrNo
                            userRoleId:(NSString *)userRoleId
                             timestamp:(NSString *)timestamp {

    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    queue.maxConcurrentOperationCount = 4;

    NSString *backgroundSessionIdentifier = [NSString stringWithFormat:@"backgroundPdfUploadIdentifier_%@",mrNo];

    NSURLSessionConfiguration *backgroundSession = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:backgroundSessionIdentifier];
    backgroundSession.discretionary = true;

    NSURLSession *session = [NSURLSession sessionWithConfiguration:backgroundSession delegate:self delegateQueue:queue];

    [session setAccessibilityLabel:mrNo];
    [session setAccessibilityValue:userRoleId];
    [session setAccessibilityHint:timestamp];

    return session;
}


- (void)uploadPdfRequest:(NSURLRequest *)request
                 forMrNo:(NSString *)mrNo
              userRoleId:(NSString *)userRoleId
             andTimestamp:(NSString *)timestamp {

    NSURLSession *session = [self uploadSessionForMrNo:mrNo userRoleId:userRoleId timestamp:timestamp];
    NSURLSessionDataTask *postDataTask = [session dataTaskWithRequest:request];
    NSLog(@"postDataTask %@ timeout %f",postDataTask,request.timeoutInterval); …
Run Code Online (Sandbox Code Playgroud)

objective-c nsurlsession nsurlsessiondatatask ios11

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

是否可以通过xcode中的xcconfig文件更改productName?

我在Config.xcconfig文件中设置以下两个参数来获取appDisplayNamebundle Identifier从配置文件.我在xcconfig文件中执行了我的代码:

appDisplayName=myapp
appIdentifier=org.prince.myapp
Run Code Online (Sandbox Code Playgroud)

在app- Info.plist文件中设置为

Bundle identifier = ${appIdentifier}
Bundle display name =${appDisplayName}
Run Code Online (Sandbox Code Playgroud)

将其添加到配置下的项目中.

它工作正常,因为我已经将myapp作为显示名称显示在模拟器/设备中.

让我们来谈谈.我想知道有没有办法改变PRODUCT_NAME变量值.我PRODUCT_NAME=custom 在配置文件中设置 ,但这似乎不起作用.

在此输入图像描述

iphone config objective-c ios

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

如何按字母顺序对字典对象进行NSArray排序?

我有未分类的字典数组,我想根据艺术家的名字对它进行排序.未列出的列表如下:

            {
                artist = "Afro Latin Jazz Orchestra";
                id = 10;
            },
                    {
                artist = "Avey, Bobby";
                id = 17;
            },
                    {
                artist = "American Symphony Orchestra";
                id = 32;
            },
                    {
                artist = "Akpan, Uwem";
                id = 97;
            },
                    {
                artist = "Austin, Ivy ";
                id = 123;
            },
                    {
                artist = "American Theatre Orchestra";
                id = 153;
            },
                    {
                artist = AudraRox;
                id = 171;
            },
                    {
                artist = "Atlas, James";
                id = 224;
            },
                    {
                artist = …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

带有上一页后退按钮的jQuery Mobile NavBar

在iPhone上,如果顶部有一个NavBar,则会有一个后退按钮.

而不是说"返回"它没有上一页的标题.

所以你可能会说"结账"页面.NavBar的标题是"Checkout",按钮可能是"Books".

单击"Books"按钮可以返回上一页.

如何在jQuery mobile中实现这一点,而不需要在后退按钮的名称中进行编码,因为您可能从不同的路径到达该页面?

编辑

我知道我可以在页面上这样做;

<div data-role="page" id="pageViewChallenges" data-add-back-btn="true" data-back-btn-text="previous">
Run Code Online (Sandbox Code Playgroud)

但这使按钮文本"上一个"而不是页面的名称.

jquery-mobile cordova

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

如何通过Health Kit将Health Records添加到Health App

我能够在健康应用程序中读取写入的示例数据,例如体重,身高,体重,并从年龄,性别,血液类型等配置文件数据中读取。下面给出了我的代码,用于请求身份验证和读写方法。

- (void)requestAuthorization {

    if ([HKHealthStore isHealthDataAvailable] == NO) {
        // If our device doesn't support HealthKit -> return.
        return;
    }

    HKObjectType *dateOfBirth = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierDateOfBirth];
    HKObjectType *bloodType = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierBloodType];
    HKObjectType *biologicalSex = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierBiologicalSex];
    HKObjectType *wheelChairUse = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierWheelchairUse];
    HKObjectType *skinType = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierFitzpatrickSkinType];

    HKObjectType *bodyMassIndex = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMassIndex];
    HKObjectType *height = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeight];
    HKObjectType *bodyMass = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass];
    HKObjectType *activeEnergy = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned];

    HKObjectType *heartRate = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate];
    HKObjectType *bloodGlucose = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierBloodGlucose];
    HKObjectType *bodyTemprature = [HKObjectType …
Run Code Online (Sandbox Code Playgroud)

objective-c healthkit

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

UITableView最后一行确实选择不正常工作?

我面临一个非常奇怪的问题.我正在使用tableView用于菜单目的.它工作正常.但问题是在该表的最后一行中,只有上半区域的火灾确实选择了事件.当我点击最后一行的中间时,确实选择不起作用.点击单元格的上半部分,选择工作正常.任何人都可以详细说明吗?

这是我使用tableView的截图: -

在此输入图像描述

这是我在backTableView的didSelect上设置表的y位置的代码.

        UITableView *menuTable=(UITableView*)[self.view viewWithTag:5];
    CGRect rect=[menuTable frame];
    rect.origin.y-=rect.size.height;

    [UIView animateWithDuration:0.3 animations:^{
        [menuTable setFrame:rect];
    } completion:^(BOOL finished) {

        [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
        isMenuOpen=YES;
        [bgView setFrame:self.view.frame];
        [self.view insertSubview:bgView belowSubview:menuTable];
        for (UIView *view in self.view.subviews) {
            if (view!=menuTable && view.tag!=44) {
                [view setUserInteractionEnabled:NO];
            }
        }
        NSLog(@"animation completed");
    }];

Setted rowHeight to 40
bringSubViewtoFront
TableHeight to 80 
Run Code Online (Sandbox Code Playgroud)

我现在能做什么?

iphone uitableview didselectrowatindexpath

4
推荐指数
2
解决办法
3259
查看次数