Quantcast
Channel: 睿论坛 - 最新话题
Viewing all articles
Browse latest Browse all 5702

Struct 返回值的方法,不知道怎么写代码

$
0
0

@laomei wrote:

坐试验,遇到一个难题:

-(struct CGRect { struct CGPoint { double x_1_1_1; double x_1_1_2; } x1; struct CGSize { double x_2_1_1; double x_2_1_2; } x2; })_applicationFrame;

这种struct 返回值的方法,如何写代码呢,我想修改 CGPoint CGSize 里面的值.

//这样,编译一大堆错误,直接懵逼。

- (struct CGRect { struct CGPoint { double x_1_1_1; double x_1_1_2; } x1; struct CGSize { double x_2_1_1; double x_2_1_2; } x2; })_applicationFrame
{
   return %orig;   
}

错误:

Tweak.xm:23:246: error: redefinition of 'CGRect'
  ...id _logos_meta_method$_ungrouped$UIScreen$mainScreen(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST, SEL); static struct CGRect { st...
                                                                                                                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:46:8: note:
      previous definition is here
struct CGRect {
       ^
Tweak.xm:23:492: error: redefinition of 'CGRect'
  ...(*_logos_orig$_ungrouped$UIScreen$_applicationFrame)(_LOGOS_SELF_TYPE_NORMAL UIScreen* _LOGOS_SELF_CONST, SEL); static struct CGRect ...
                                                                                                                                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:46:8: note:
      previous definition is here
struct CGRect {
       ^
Tweak.xm:32:15: error: redefinition of 'CGRect'
static struct CGRect { struct CGPoint { double x_1_1_1; double x_1_1_2; } x1; struct CGSize { double x_2_1_1; double x_2_1_2; } x2; ...
              ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:46:8: note:
      previous definition is here
struct CGRect {
       ^
3 errors generated.

//这样编译通过,但不知道,怎么改 CGPoint CGSize 其值:

	- (id)_applicationFrame
	{
		NSLog(@"xxxxxxxxxxxxxxxxxxxx");
		return %orig;
	}

//我想应该是这样

- (id)_applicationFrame
{
     id a=%orig;
	 //这里,如何把id a 再转回struct呢??
     a.size.width=888;
	 a.size.height=888; 
     return a;   
}

求教各位老师,谢谢.

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5702

Trending Articles