ios - 新的引用 socket ,查看 UIviewcontroller

标签 ios objective-c uiviewcontroller

所以,我在 youtube 上学习本教程。我想向我的应用程序添加饼图。但是,当我尝试将新的引用导出从我的 PieChart View 添加到我的 View Controller (于 5:01 完成)时,Xcode 不允许我这样做。有办法解决这个问题吗?

这是我的 View Controller .m

//
//  checkAttendanceViewController.m
//  timetable app
//
//  Created by Robin Malhotra on 29/12/13.
//  Copyright (c) 2013 Robin's code kitchen. All rights reserved.
//

#import "checkAttendanceViewController.h"

@interface checkAttendanceViewController ()

@end

@implementation checkAttendanceViewController

@synthesize pieChartView;

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

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSMutableArray *array=[[NSMutableArray alloc]init];

    for (int i=0; i<5; i++)
    {
        NSNumber *number=[NSNumber numberWithInt:rand()%60+20];
        [array addObject:number];

    }

    [self.pieChartView renderInLayer:self.pieChartView dataArray:array];

        // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

和我的viewcontroller.h

//
//  checkAttendanceViewController.h
//  timetable app
//
//  Created by Robin Malhotra on 29/12/13.
//  Copyright (c) 2013 Robin's code kitchen. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "DLPieChart.h"


@interface checkAttendanceViewController : UIViewController
@property(nonatomic,retain) IBOutlet DLPieChart *pieChartView;
@end

这是一个 dropbox如果有人想自己尝试一下,请链接(我知道我不应该共享外部链接,但我已经粘贴了适当的代码,并且我不确定如何在 stackoverflow 中粘贴 Storyboard

最佳答案

当我遇到这种情况时,通常是因为 xib 中 View 的类类型与源文件中的 socket 类类型不匹配。

  • 在 Storyboard或 xib 中选择 View
  • 选择 View->Utilities->Show Identity Inspector(在 Xcode 右侧可见)
  • 确保“自定义类”文本字段设置为“DLPieChart”(在您的 socket 中定义的类型)

关于ios - 新的引用 socket ,查看 UIviewcontroller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20828998/

相关文章:

ios - swift : Make a very short vibration

android - `cordova build ios` - 抛出错误,如何解决?

ios - 如何与代码并排打开 SwiftUI 预览?

ios - Objective-C/Sprite 套件 : How do I access variables stored in UIViewController?

ios - 以编程方式关闭弹出 View

ios - 使用模拟数据测试 URLSession 委托(delegate)

ios - AFNetworking 预期读取的字节为 -1

ios - 查找 view.subviews 中的所有按钮

iphone - 核心数据对象失效

iOS 检查 ViewController 实例是否打开并切换 ViewControllers