我如何发现两种同类物体之间的价值差异。 例 我有一个有X, y, width, 高地特性和两条直径的物体。 我如何发现(无论是从方案角度还是从任何视觉工具或图书馆等)一种混杂物的特性与第二个混杂物不同?
或者在青少年或档案中是否有任何获得物体的国家?
我如何发现两种同类物体之间的价值差异。 例 我有一个有X, y, width, 高地特性和两条直径的物体。 我如何发现(无论是从方案角度还是从任何视觉工具或图书馆等)一种混杂物的特性与第二个混杂物不同?
或者在青少年或档案中是否有任何获得物体的国家?
如果你真的
+ (BOOL) compareObject:(id)obj1 withObject:(id)obj2 {
unsigned int varCount1, varCount2;
if ([obj1 class] != [obj2 class]) return NO;
Ivar *vars1 = class_copyIvarList([obj1 class], &varCount1);
Ivar *vars2 = class_copyIvarList([obj2 class], &varCount2);
BOOL match = YES;
for (int i = 0; i < varCount1; i++) {
Ivar var1 = vars1[i];
for (int j = 0; i < varCount2; j++) {
Ivar var2 = vars2[j];
if (strcmp(ivar_getName(var1), ivar_getName(var2)) == 0) {
if (object_getIvar(obj1, var1) != object_getIvar(obj2, var2)) {
match = NO;
break;
}
}
}
if (!match) break;
}
free(vars1);
free(vars2);
return match;
}
如果你印刷该物体的描述,你将了解这些数值。
For eg,
CGRect rect = CGRectMake(10,10,20,20);
Rectangle *rectObject = [[Rectangle alloc] initWithFrame:rect];
NSLog(@"Desc : %@",[rectObject description]);
而且,如果你想要比较,
页: 1
页: 1
同样,你也可以得到,,
NSLog(@"Width : %f", rectObject.frame.size.width);
NSLog(@"Height : %f", rectObject.frame.size.height);
如果Xy等值浮动,则假设为Rec1, 而Rect2为2个目标,则为2个。
NSLog(@"for Rect1
x %f y %f
For Rect2
x %f y%f",Rect1.x,Rect1.y,Rect2.x,Rext2.y);
这将分别显示Ret1和Rect2的x和 y。
如果你要检查,如果两个变量点到same instance,则你可使用obj1= obj2
对其进行比较。
如果你想要检查,如果你的班级有两种不同的成员价值,你必须自行检查每个数值。 (例如obj1.property1 = obj2.property2
)。
如果你只想检查同样的问题,在偷窃时,就把注意力放在一个破碎点上,并看着X条码的 de。 你可以检查那里的所有生物物体。 只字不提你的目标。 当地变量(在散货时已有的)直接列出,成员被组合成自己。
For a basic app with nonconsumable in-app purchases, has anyone figured out best practices for using SKPaymentQueue s restoreCompletedTransactions? Observations I know it s recommended to always ...
I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...
I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I ...
I ve been working on adding in-app purchases and was able to create and test in-app purchases using Store Kit (yay!). During testing, I exercised my app in a way which caused the app to crash mid ...
In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...
Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...
I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...
Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...