小编Ook*_*key的帖子

弹出UIViewController

我正在尝试按下按钮来弹出一个弹出窗口.试图按照我在谷歌中找到的说明,但我的流行视图以全屏显示,其背景为黑色.这是我的代码:

class ViewController: UIViewController, UIPopoverPresentationControllerDelegate {

    @IBAction func someButtonPressed(sender: UIButton) {
        let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let popupVC = storyboard.instantiateViewControllerWithIdentifier("hello") as! popupViewController
        popupVC.modalPresentationStyle = .Popover
        popupVC.preferredContentSize = CGSizeMake(300, 300)
        let pVC = popupVC.popoverPresentationController
        pVC?.permittedArrowDirections = .Any
        pVC?.delegate = self
        pVC?.sourceView = sender
        pVC?.sourceRect = CGRect(x: 100, y: 100, width: 1, height: 1)
        presentViewController(popupVC, animated: true, completion: nil)
    }
}
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

popup ios swift

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

检查字符串是拉丁字母还是西里尔字母

有什么方法可以检查某些字符串是拉丁字母还是西里尔字母吗?我尝试过localizedCompareString 方法,但它没有给我所需的结果。

ios swift

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

尝试在单例中更改变量但它保持可为空

刚刚开始编写objective-c编程,现在我遇到了自己无法解决的问题.我正在从异步请求接收数据并尝试将其转发为单例,但它没有改变.

这是我正在尝试存储我的数据
Data.h的地方

#import <Foundation/Foundation.h>
@interface Data : NSObject
@property (nonatomic, strong) NSDictionary *products;
-(void)setProducts:(NSDictionary *)value;
@end
Run Code Online (Sandbox Code Playgroud)

Data.m

#import "Data.h"

@implementation Data

+(Data *)sharedInstance
{
    static Data *_sharedInstance = nil;
    static dispatch_once_t oncePredicate;
    dispatch_once(&oncePredicate, ^{
        _sharedInstance = [[Data alloc] init];
    });
    return _sharedInstance;
}

- (id)init {
    self = [super init];
    if ( self )
    {
        _products = [[NSDictionary alloc] init];
    }
    return self;
}

@end
Run Code Online (Sandbox Code Playgroud)

这是我从服务器接收数据的类:
ConnectionService.m

- (void)getProductsWithCompletion:(void (^)(NSDictionary *products))completion
{
    NSString *urlString = [NSString stringWithFormat:@"serverurl", [[AppDelegate instance]getUrl]]; …
Run Code Online (Sandbox Code Playgroud)

objective-c

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

谷歌登录 API

首先需要说的是,我不使用 CocoaPods。这是我第一次使用 Google API。
在 Google 指南中说我需要GIDSignInapplication:didFinishLaunchingWithOptions:方法中进行配置,但我也使用在此方法中配置的 Facebook API。此外,当我尝试在此方法中配置 G API 时,我收到错误:Type 'AppDelegate' does not conform to protocol 'GIDSignInDelegate'Value of type 'GIDSignIn' has no member 'configureWithError'.
如何GIDSignIn在 AppDelegate 中不配置?

Bridging Header

#ifndef Bridging_Header_h
#define Bridging_Header_h

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <Bolts/Bolts.h>
#import <GoogleSignIn/GoogleSignIn.h>

#endif

AppDelegate

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//        var configureError: NSError?
//        GGLContext.sharedInstance().configureWithError(&configureError) …
Run Code Online (Sandbox Code Playgroud)

ios swift gidsignin

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

标签 统计

ios ×3

swift ×3

gidsignin ×1

objective-c ×1

popup ×1