小编Jac*_*ack的帖子

SwiftUI VStack 对齐错误?

我最近一直在 SwiftUI 中构建一个应用程序,今天我注意到 VStack Alignment 有一些奇怪的行为。无论我使用什么对齐方式,视图都不会在中心之外对齐。见下文:

VStack(alignment: .trailing, spacing: 0) {
    Text("Hello, World!")
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

VStack(alignment: .center, spacing: 0) {
    Text("Hello, World!")
}
Run Code Online (Sandbox Code Playgroud)

开关

它在预览和模拟器中都这样做,我试图将我的文本与屏幕的右边缘对齐。

完整代码:

import SwiftUI

struct DemoView: View {
    var body: some View {
        VStack(alignment: .center, spacing: 0) {
            Text("Hello, World!")
        }
    }
}

struct DemoView_Previews: PreviewProvider {
    static var previews: some View {
        DemoView()
    }

}
Run Code Online (Sandbox Code Playgroud)

alignment swift swiftui vstack

3
推荐指数
2
解决办法
317
查看次数

Stripe创建客户iOS

我正在使用条带和解析来允许我的应用程序的用户输入他们的信用卡并购买.我到目前为止用户可以购买一切都很好.但我希望允许用户输入他们的CC信息并进行保存,这样他们就不必再继续输入了.我真的很难做到这一点我得到了第一部分都弄明白我只需要得到这个.

更新:

- (IBAction)save:(id)sender {
    if (![self.paymentView isValid]) {
        return;
    }
    if (![Stripe defaultPublishableKey]) {
        UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"No Publishable Key"
                                                          message:@"Please specify a Stripe Publishable Key in Constants.m"
                                                         delegate:nil
                                                cancelButtonTitle:NSLocalizedString(@"OK", @"OK")
                                                otherButtonTitles:nil];
        [message show];
        return;
    }
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    STPCard *card = [[STPCard alloc] init];
    card.number = self.paymentView.card.number;
    card.expMonth = self.paymentView.card.expMonth;
    card.expYear = self.paymentView.card.expYear;
    card.cvc = self.paymentView.card.cvc;
    [Stripe createTokenWithCard:card completion:^(STPToken *token, NSError *error) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        if (error) {
            [self hasError:error];
        } else {
           [self …
Run Code Online (Sandbox Code Playgroud)

ios stripe-payments parse-platform

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

UISaveVideoAtPathToSavedPhotosAlbum不保存视频到相机胶卷

我正试图用glimpse录制UIView.它成功将其保存到应用程序的文档文件夹中,但是我还需要它保存到用户的相机胶卷.它没有保存到相机胶卷,我收到警报,允许该应用程序访问我的相机胶卷,但它不保存在任何相册中.

我尝试过相当数量的代码,范围从:

[self.glimpse startRecordingView:self.view onCompletion:^(NSURL *fileOuputURL) {
        NSLog(@"DONE WITH OUTPUT: %@", fileOuputURL.absoluteString);


      UISaveVideoAtPathToSavedPhotosAlbum(fileOuputURL.absoluteString,nil,nil,nil);





    }];
Run Code Online (Sandbox Code Playgroud)

对此:

 ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
        [library writeVideoAtPathToSavedPhotosAlbum:fileOuputURL
                                    completionBlock:^(NSURL *assetURL, NSError *error){NSLog(@"hello");}];
Run Code Online (Sandbox Code Playgroud)

日志打印但不会将视频保存到相机胶卷.

如果有人对我有任何想法这不起作用请告诉我!谢谢!

video ios alassetslibrary camera-roll

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