UITextView还是其他什么?(UITextView or something else? need help in understanding)
我正在写一个小应用程序来训练自己,我需要一些帮助。
任何人都可以给我一个建议如何使这个结构如下图所示? 我对“描述”部分感兴趣。 我想在我的应用程序中做类似的事情。 预览中的一些文本。按钮“更多”,当我点击它时,整个文本将出现在屏幕上。 我也希望有相同的按钮“隐藏”让我回到预览状态。 我需要UITextView或其他吗?
i'm writing a small app to train myself and i need a little help.
can anyone give me an advice how to make this construction like on the picture bellow? i'm interested about "Description" section. i want to make the similar thing in my app. some text in preview..button "more" and when i click it the whole text will appear on the screen. also i want to have the same button "hide" that returned me to the preview. i need UITextView or smth else?
原文:https://stackoverflow.com/questions/19553952
最满意答案
您可以使用以下代码:
public static void main(String[] args) { String version1 = "1.0.4.1"; String version2 = "1.0.6.1"; int result = compare(version1, version2); if(result==1){ System.out.println("Latest version:"+version1); }else if(result==-1){ System.out.println("Latest version:"+version2); }else{ System.out.println("Both version same:"+version2); } } public static int compare(String version1, String version2){ String ver1[]=version1.split("\\."); String ver2[]=version2.split("\\."); int counter =0; int len1= ver1.length; int len2= ver2.length; for(String v:ver1){ if(len1>0 && len2>0 && v.compareTo(ver2[counter])>0 ){ return 1; }else{ if(len1>0 &&p; len2>0 && v.compareTo(ver2[counter])<0) { return -1; }else{ len1--; len2--; counter++; } } } if(ver1.length > ver2.length){ return 1; }else if(ver1.length < ver2.length){ return -1; } return 0; }
You could use the following code:
public static void main(String[] args) { String version1 = "1.0.4.1"; String version2 = "1.0.6.1"; int result = compare(version1, version2); if(result==1){ System.out.println("Latest version:"+version1); }else if(result==-1){ System.out.println("Latest version:"+version2); }else{ System.out.println("Both version same:"+version2); } } public static int compare(String version1, String version2){ String ver1[]=version1.split("\\."); String ver2[]=version2.split("\\."); int counter =0; int len1= ver1.length; int len2= ver2.length; for(String v:ver1){ if(len1>0 && len2>0 && v.compareTo(ver2[counter])>0 ){ return 1; }else{ if(len1>0 && len2>0 && v.compareTo(ver2[counter])<0) { return -1; }else{ len1--; len2--; counter++; } } } if(ver1.length > ver2.length){ return 1; }else if(ver1.length < ver2.length){ return -1; } return 0; }
相关问答
更多-
这两种形式可以完全相同的字节码,你可以清楚地验证: >>> import dis >>> dis.dis(compile('if x not in d: pass', '', 'exec')) 1 0 LOAD_NAME 0 (x) 3 LOAD_NAME 1 (d) 6 COMPARE_OP 7 (not in) ...
-
0x来自哪里?(where does 0x come from? [duplicate])[2023-05-03]
我认为,因为x来自hex , 0表示它是一个数字。 I think, because x comes from hex and 0 is to indicate that it is a number. -
用x字符创建所有可能字符串的算法[重复](Algorithm for creating all possible strings with x characters [duplicate])[2023-06-07]
你可以用递归来试试: COMBINATIONS(array, length): COMBINATIONS("", array, length) COMBINATIONS(string, array, length): IF length == 0 VISIT(string) ELSE FOR EACH c IN array COMBINATIONS(string + c, array, length - 1) 基本思想是以空 ... -
没有性能差异,因为它们编译为相同的字节码: Python 2.6.2 (r262:71600, Apr 15 2009, 07:20:39) >>> import dis >>> def f(x): ... return x is not None ... >>> dis.dis(f) 2 0 LOAD_FAST 0 (x) 3 LOAD_CONST 0 (None) ...
-
更改 #define func(x, y) x + y/x 至 #define func(x, y) ((x) + (y)/(x)) 原因: func(x, y) x + y/x x = i + j y = 3 func(x, y) = func(i + j, 3) = x + y/x = i + j + 3/i + j = -1 + 2 + 3/(-1) + 2 = 1 - 3 + 2 = 0 change #define func(x, y) x + y/x To #define f ...
-
按照标准 - 它们在语义上是等价的。 运行时语义的相关部分: 让op为@ ,其中AssignmentOperator是@= 。 设r是将op应用于lval和rval的结果,就好像计算表达式lval op rval 。 表演? PutValue(lref, r) 。 这两个片段之间是否存在任何有意义的差异? 这些之间不应有任何可观察到的差异。 至于我原来的问题,我想知道是否存在任何语义差异,因为如果没有,我想知道为什么Chrome不会将复合赋值减去x = x + 1形式。 优化是一个复杂的主题。 let (最 ...
-
比较两个版本字符串(4.xxx,5.xxx)[重复](Comparing two version strings (4.x.x.x, 5.x.x.x) [duplicate])[2023-12-24]
您可以使用以下代码: public static void main(String[] args) { String version1 = "1.0.4.1"; String version2 = "1.0.6.1"; int result = compare(version1, version2); if(result==1){ System.out.println("Latest version:"+version1); }else if(re ... -
有{| x |(Is there a { |x| x } shorthand in ruby?)[2023-12-23]
如果您不关心返回的内容,有时可以使用hash方法。 但是,您要求的功能尚未在Ruby中提供。 它存在于Ruby路线图中: https://bugs.ruby-lang.org/issues/6373 预计在2035-12-25之前实施,你能等吗? 话虽如此,打字多少是group_by{|x|x} ? 编辑: 正如Stefan指出的那样,自从引入Object#itself以来,我对Ruby 2.2及更高版本的回答现在更长。 If you do not care about what is returned y ... -
浏览器在每个请求中向服务器发送用户代理字符串 。 它包含有关浏览器和操作系统的一些信息。 The browser sends a user agent string to the server in every request. It contains some information about the browser and the operating system.
-
R中的“x”和“x”,x < - 5和x = 5是相同的吗?(“x” and 'x' , x <- 5 and x = 5 are same in R? [duplicate])[2023-06-22]
在您的示例中,答案是肯定的。 但请参阅以下注释: https://stat.ethz.ch/R-manual/R-devel/library/base/html/Quotes.html 单引号和双引号分隔字符常量。 它们可以互换使用,但首选双引号(字符常量使用双引号打印),因此单引号通常仅用于分隔包含双引号的字符常量。 http://blog.revolutionanalytics.com/2008/12/use-equals-or-arrow-for-assignment.html 在我们继续之前的一点历 ...