当前位置: 编程技术>移动开发
本页文章导读:
▪objective-c id的意思 objective-c id的意义
id用于指代任意实体对象的存放路径;
比如说id=(NSString *)
id=(NSDictionary *)
如果一个函数的参数是id
那么此处需要传指针值,比如说NSString *test=[NSString allo] init];
那.........
▪ 【转】gen already exists but is not a source folder 【转】gen already exists but is not a source folder.
【ERROR】gen already exists but is not a source folder. Convert to a source folder or rename it
This is a common error and you can solve it following these steps:
Right click on the project and.........
▪ 图片旋转翻转跟初始坐标系的关系 图片旋转翻转和初始坐标系的关系
package laladin.angleTest;
import java.util.ArrayList;
import java.util.List;
public class AngleTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated metho.........
[1]objective-c id的意思
来源: 互联网 发布时间: 2014-02-18
objective-c id的意义
id用于指代任意实体对象的存放路径;
比如说id=(NSString *)
id=(NSDictionary *)
如果一个函数的参数是id
那么此处需要传指针值,比如说NSString *test=[NSString allo] init];
那么传输的参数是test;
如果一个函数的参数是(id *)
那么此处需要传指针值的索引值,比如说NSString *test=[NSString allo] init];
那么传输的参数是&test;
example:
NSString *testparam=[NSString allo] init];
第一种情况:
-(void) testid:(id)param;
调用方式:testid:testparam;
第一种情况:
-(void) testid:(id *)param;
调用方式:testid:&testparam;
[2] 【转】gen already exists but is not a source folder
来源: 互联网 发布时间: 2014-02-18
【转】gen already exists but is not a source folder.
【ERROR】gen already exists but is not a source folder. Convert to a source folder or rename it
This is a common error and you can solve it following these steps:
Right click on the project and go to “Properties”
Select “Java Build Path” on the left
Open “Source” tab
Click “Add Folder…”
Check “gen” folder and click Ok and Ok again
Again right click on the project and in the “Andriod Tools” click on “Fix Project Properties”
[3] 图片旋转翻转跟初始坐标系的关系
来源: 互联网 发布时间: 2014-02-18
图片旋转翻转和初始坐标系的关系
package laladin.angleTest; import java.util.ArrayList; import java.util.List; public class AngleTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String state="1234"; int key; List<Integer> list=new ArrayList<Integer>(); StringBuffer sb=new StringBuffer(); for(int i=0;i<100;i++){ key=(int)(Math.random()*5); switch (key) { case 0: //转90 list.add(90); state=rotate(state,90); sb.append("转90,"); break; case 1: //转180 list.add(180); sb.append("转180,"); state=rotate(state,180); break; case 2: //转270 list.add(270); sb.append("转270,"); state=rotate(state,270); break; case 3: //水平 list.add(-1); sb.append("水平,"); state=hFlip(state); break; case 4: //垂直 list.add(-2); sb.append("垂直,"); state=vFlip(state); break; } } System.out.println(sb.toString()); System.out.println(state); state="1234"; int aa=rotateAndFlip(list); if(aa<0) state=hFlip(state); state=rotate(state,Math.abs(aa)); System.out.println(state); } public static String rotate(String string,int degree){ switch (degree) { case 90: string=string.substring(3)+string.substring(0, 3); break; case 180: string=string.substring(2)+string.substring(0,2); break; case 270: string=string.substring(1)+string.substring(0,1); break; } return string; } public static String hFlip(String string){ string=string.substring(1,2)+string.substring(0,1)+string.substring(3)+string.substring(2,3); return string; } public static String vFlip(String string){ string=string.substring(3)+string.substring(2,3)+string.substring(1,2)+string.substring(0,1); return string; } /** * 旋转和翻转过后与原图的比较 * @param list 得到的步骤集合,-1表示水平翻转,-2表示垂直翻转,0到360表示旋转度数. * @return 返回结果,数值表示需要顺时针旋转的度数,符号位表示是否需要水平翻转.<br /> * 如果得到的是一个正数,那么原图只需做相应度数的顺时针旋转<br /> * 如果得到的是一个负数,那么原图需要先做一次水平翻转,再做相应度数的顺时针旋转.<br /> */ public static int rotateAndFlip(List<Integer> list){ /**是否需要翻转**/ boolean needRotate=false; /**需要旋转的度数**/ int degree=0; for (Integer integer : list) { switch (integer) { case -1://水平翻转 if(needRotate=!needRotate) degree=360-degree; else degree=-degree; break; case -2://垂直翻转 degree=180-degree; needRotate=!needRotate; break; default: degree=degree+integer; break; } if (degree<0) degree=degree+360; if (degree>=360) degree=degree-360; } if (needRotate)degree=-degree; if(needRotate && degree==0)return -360; return degree; } }
最新技术文章: