我是 iPhone 开发的新手,我想在现有课程中分配一个课程
这是在 C# 中声明的内容
public partial class UserRegisteration : System.Web.UI.Page
{
//some methods
public class Mime
{
//some methods
}
}
像Objective-C中的上述格式一样,如何在现有类中再分配一个类?
有任何想法吗?提前致谢。
我是 iPhone 开发的新手,我想在现有课程中分配一个课程
这是在 C# 中声明的内容
public partial class UserRegisteration : System.Web.UI.Page
{
//some methods
public class Mime
{
//some methods
}
}
像Objective-C中的上述格式一样,如何在现有类中再分配一个类?
有任何想法吗?提前致谢。
是的,你可以。我在现有课程中使用一个课程。一是延伸UIView,二是延伸NSObject。
多布局.h
    @interface MultiLayout  : UIView
    {
   // methods and properties
    }
    @end
    @interface SingleControl : NSObject
    {
   // methods and properties
    }
    @end
多布局.m
@implementation SingleControl
//methods and variables declaration and property synthesization
@end
@implementation MultiLayout
//methods and variables declaration and property synthesization
@end
用于在 MultiLayout 中获取 SingleControl 的静态值。你必须调用类方法,如:
多布局.h
 @interface  MultiLayout : UIView
    {
   // methods and properties
    }
    @end
    @interface SingleControl : NSObject
    {
   // methods and properties
    }
   // add class method
   +(int)getValue;
    @end
多布局.m
    @implementation SingleControl
    // add static value 
    static int values = 100;
    // implement method
   +(int)getValue{
    return values;
    }
    @end
    @implementation MultiLayout
    // call method to get value
     [SingleChoiceControl getValue];
    @end
    如果我正确理解您的问题,您可以在界面文件中执行此操作:
@interface Mime 
//properties and method declarations
@end
@interface UserRegistration : System.Web.UI.Page
@property (strong, nonatomic) Mime *mimeInstance;
@end
然后在实现文件中你像这样实现两者:
@implementation Mime 
//implementation
@end
@implementation UserRegistration
//implementation
@end