小编ZYi*_*iOS的帖子

对UITabBarController的开始/结束外观转换的不平衡调用

我有一个UITabBarController,在初始运行时,我想覆盖登录视图控制器但收到错误.

对<UITabBarController:0x863ae00>的开始/结束外观转换的不平衡调用.

下面是代码.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point for customization after application launch.

    UIViewController *lessonVC = [[[LessonViewController alloc] initWithNibName:@"LessonViewController" bundle:nil] autorelease];

    UIViewController *programVC = [[[ProgramViewController alloc] initWithNibName:@"ProgramViewController" bundle:nil] autorelease];

    UIViewController *flashcardVC = [[[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bundle:nil] autorelease];

    UIViewController *moreVC = [[[MoreViewController alloc] initWithNibName:@"MoreViewController" bundle:nil] autorelease];

    UINavigationController *lessonNVC = [[[UINavigationController alloc] initWithRootViewController:lessonVC] autorelease];

    UINavigationController *programNVC = [[[UINavigationController alloc] initWithRootViewController:programVC] autorelease];

    UINavigationController …
Run Code Online (Sandbox Code Playgroud)

iphone uitabbarcontroller transitions ipad

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

当计数标志表情符号时,Swift countElements()返回不正确的值

let str1 = ""
let str2 = "....."

println("\(countElements(str1)), \(countElements(str2))")
Run Code Online (Sandbox Code Playgroud)

结果:1,10

但是str1不应该有5个元素吗?

这个错误似乎只发生在我使用标志表情符号时.

unicode ios emoji swift countelements

15
推荐指数
1
解决办法
3032
查看次数

如何使用CATransform3DRotate旋转UIImageView会产生像开门一样的效果?

我已阅读并试用这篇文章(使用Core Animation打开门效果)

我在我的应用程序中实现以下代码:

    CALayer *layer = threeHomeView.layer;
CATransform3D initialTransform = threeHomeView.layer.transform;
initialTransform.m34 = 1.0 / -900;

[UIView beginAnimations:@"Scale" context:nil];
[UIView setAnimationDuration:3];
layer.transform = initialTransform;
CATransform3D rotationAndPerspectiveTransform = threeHomeView.layer.transform;

rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform
                                                      , 40.0f * M_PI / 180.0f
                                                      , 0.0f
                                                      , 1.0f
                                                      , 0.0f);
layer.transform = rotationAndPerspectiveTransform;

[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(threeHomeFlyOut)];
[UIView commitAnimations];  
Run Code Online (Sandbox Code Playgroud)

threeHomeView是一个UIImageView.

我的问题是:图像只能通过图像的中间垂直线旋转,但我想让它按图像的左垂直线旋转.

iphone core-animation catransform3d sliding-doors

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

UIActivity自定义共享,触摸更多按钮时不显示缩略图图标

我的应用程序支持iOS 7+,我使用UIActivity图像大小:iPhone为60pt,iOS为iPad为76pt,

当触摸更多按钮重新排序项目时,它无法显示列表中的图标.

显示分享活动

在此输入图像描述

代码如下:

class ZYShare {
class ActivityItem {
    init() {
        self.title = ""
        self.icon = ""
    }

    var title: String?
    var icon: String?
    var type: ShareType = ShareTypeAny
}

class CommonActivity: UIActivity {
    lazy var itemInfo = ActivityItem()

    override func prepareWithActivityItems(activityItems: [AnyObject]) {
        // do something

    }

    override func canPerformWithActivityItems(activityItems: [AnyObject]) -> Bool {
        return true
    }

    override class func activityCategory() -> UIActivityCategory {
        return UIActivityCategory.Action
    }

    override func activityType() -> String? {

        return NSLocalizedString(itemInfo.title ?? "", comment: …
Run Code Online (Sandbox Code Playgroud)

iphone share ios uiactivity uiactivitycategory

9
推荐指数
1
解决办法
1328
查看次数

CDN:运行“pod install”时无法在某些 React Native 项目中下载主干 URL?

我有这个反应本机项目,我在多台计算机上工作,在我的 MacBook 中一切正常,当我在运行“npm install”后运行“pod install”时,pods 项目成功创建,另一方面,当我在我的桌面出现以下错误:

在此处输入图片说明

我试过为其他项目安装 pod,一切正常,尤其是这个项目的问题。

更新:

感谢您的评论,让您知道:

运行后:

pod repo remove trunk
pod install
Run Code Online (Sandbox Code Playgroud)

这就是我得到的:

在此处输入图片说明

这是我的 package.json:

{
  "name": "aksystems",
  "version": "3.9.8",
  "description": "",
  "author": "",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "ios": "cd ios/ && rm -rf Pods/ && rm -rf Podfile.lock && pod install && cd ../ && react-native run-ios",
    "android": "cd android/ && ./gradlew clean && cd ../ && react-native run-android",
    "build:ios": "node node_modules/react-native/local-cli/cli.js bundle --entry-file='index.js' --bundle-output='./ios/mstore/main.jsbundle' --dev=false …
Run Code Online (Sandbox Code Playgroud)

cdn ios cocoapods react-native

9
推荐指数
2
解决办法
7739
查看次数

如何打开网址需要使用uiwebview的用户名和密码?

我想在UIWebview中打开需要密码和用户名的URL.比如打开我的本地Wifi路由器(192.168.1.1).但是当我尝试使用代码时,Safari没有弹出窗口要求密码和用户名.

NSURL *url = [NSURL URLWithString:@"http://192.168.1.1"];
NSURLRequest *httpReq = [NSURLRequest requestWithURL:url];
[self._webView loadRequest:httpReq];
Run Code Online (Sandbox Code Playgroud)

由于有人告诉我使用NSURLConnectionDelegate,我知道这一点,但我不知道如何向UIWebView显示授权页面.

iphone uiwebview

6
推荐指数
1
解决办法
5469
查看次数

是否可以使用Swift旋转IBDesignable UIButton?

如何制作具有角度的IBDesignable组件:旋转视图的CGFloat属性

import UIKit

@IBDesignable
class MyB: UIButton {
    @IBInspectable
    var angle: CGFloat = 0 {
        didSet {
            //What to put here?
        }
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        // Initialization code
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}
Run Code Online (Sandbox Code Playgroud)

我试过了

self.transform = CGAffineTransformMakeRotation(angle)
Run Code Online (Sandbox Code Playgroud)

但它不起作用

swift

6
推荐指数
1
解决办法
1048
查看次数

SwiftUI 在 `.safeAreaInset` 中添加 `menu` 导致奇怪的布局问题

这是示例项目源代码:示例代码

import SwiftUI

struct TestMenuInSafeAreaInset: View {
    @State private var message = ""

    var body: some View {
        VStack {
            Rectangle()
                .fill(Color.blue)
        }
            .safeAreaInset(edge: .bottom) {
                HStack {
                    TextField("Input your message", text: $message)
                        .padding()
                        .background(Color.brown)
                        .cornerRadius(12)
                        .foregroundColor(.white)
                    Menu {
                        Button {

                        } label: {
                            Text("Confirm")
                        }

                        Button {

                        } label: {
                            Text("Cancel")
                        }

                    } label: {
                        Image(systemName: "square.and.arrow.up.fill")
                            .tint(.white)
                            .padding()
                            .background(Color.brown)
                            .cornerRadius(50)
                    }
                }
                .padding()
            }
    }
}

struct TestMenuInSafeAreaInset_Previews: PreviewProvider {
    static var previews: some View {
        TestMenuInSafeAreaInset() …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui safearea ios16

6
推荐指数
1
解决办法
707
查看次数

如果可以从UITableView生成PDF文件?

我的应用程序有一个带有自定义单元格的tableview(包括textfield,label和button),我想从tableview生成一个pdf文件.

贝娄是代码(现在假设tableview的内容全部可见):

    UIGraphicsBeginImageContext(self._tableView.bounds.size);
    UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, self._tableView.bounds.size.width, self._tableView.bounds.size.height), nil);

    // what's the code here?
    // [self._tableView drawInRect:];

    UIGraphicsEndPDFContext();
Run Code Online (Sandbox Code Playgroud)

我总是生成一个空白的pdf文件.目前我所做的是将tableview生成为图像,然后将图像绘制到当前上下文,然后获取pdf文件.但任何好主意?

iphone pdf-generation uitableview

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

为什么Objective-C在方法定义的末尾允许使用分号?

可能重复:
Objective-C实现文件中方法名称后面的分号

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

为什么我加; 在功能结束时也是正确的?

objective-c

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

Xcode 6 beta4,UIButton在collectionviewcell中不负责任

我正在使用Xcode 6.0 beta 4,我发现它中的按钮UICollectionViewCell不响应水龙头.

细节如下:

UICollectionViewController
Run Code Online (Sandbox Code Playgroud)

--- UICollectionViewCell

------ UIButton(UIButton有两个autolayout约束,放在UIButton垂直中心和水平中心Cell)

现在使cell大小如下:(300,1000)

在iPhone模拟器或iOS 7.0或7.1.x设备中运行应用程序,按钮不可触摸,但在iOS 8.0模拟器中测试没关系.另外,如果我改变小区size(300, 200),按钮的工作原理.

我认为这是Xcode测试版中的一个错误,对吧?

我可以在哪里解决这个问题?

uibutton ios uicollectionviewcell xcode6

4
推荐指数
1
解决办法
762
查看次数

xcode 6 GM发布后崩溃

我使用OS 10.10,Xcode 6 GM,我的项目由swift(&Objective-C)编写.

该项目可以使用Xcode 6-beta7运行.

Process:               Xcode [7267]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               6.0 (6299)
Build Info:            IDEFrameworks-6299000000000000~8
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [7267]
User ID:               501

Date/Time:             2014-09-10 17:25:38.697 +0800
OS Version:            Mac OS X 10.10 (14A343f)
Report Version:        11
Anonymous UUID:        587D71D4-C53F-50BF-625D-CF092416EEDC


Time Awake Since Boot: 12000 seconds

Crashed Thread:        14  Dispatch queue: shared-compile-command-queue :: NSOperation 0x7f887f8aa900 (QOS: UTILITY)

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
ProductBuildVersion: 6A313 …
Run Code Online (Sandbox Code Playgroud)

xcode6 xcode6gm

4
推荐指数
1
解决办法
3206
查看次数