小编its*_*ode的帖子

给UIView圆角

我的登录视图有一个子视图,其中有一个UIActivityView和一个UILabel说"登录...".此子视图的拐角不是圆角.我怎样才能让它们成圆形?

有没有办法在我的xib中做到这一点?

cocoa-touch uiview ios

562
推荐指数
11
解决办法
31万
查看次数

UIStackView可以滚动吗?

假设我在UIStackView中添加了更多可以显示的视图,如何制作UIStackView滚动?

uiscrollview ios uistackview

174
推荐指数
9
解决办法
8万
查看次数

从函数返回C字符串

我试图从函数返回一个C字符串,但它不起作用.这是我的代码.

char myFunction()
{
    return "My String";
}
Run Code Online (Sandbox Code Playgroud)

在主要我称之为:

int main()
{
  printf("%s",myFunction());
}
Run Code Online (Sandbox Code Playgroud)

我也尝试了一些其他的方法,myFunction但他们没有工作.例如:

char myFunction()
{
  char array[] = "my string";
  return array;
}
Run Code Online (Sandbox Code Playgroud)

注意:我不允许使用指针!

关于这个问题的小背景:有一个功能是找出它是哪个月; 如果它1然后它返回1月等等

因此,当它打印时,它就是这样做的.printf("Month: %s",calculateMonth(month));.现在的问题是如何从calculateMonth函数中返回该字符串.

c

98
推荐指数
5
解决办法
27万
查看次数

"!"的目的是什么?和"?" 在方法名称的末尾?

有时我看到Ruby中的方法有"?" 和"!" 在他们的最后,例如:

name = "sample_string"
name.reverse
name.reverse!
name.is_binary_data?
Run Code Online (Sandbox Code Playgroud)

我想知道他们的目的是什么?它们只是语法糖衣吗?

ruby syntax

96
推荐指数
4
解决办法
4万
查看次数

使用按钮以编程方式更改屏幕方向

我认为这是可实现的,因为屏幕旋转行为可以达到应用程序级别.

android screen-orientation android-button

91
推荐指数
5
解决办法
12万
查看次数

如何模拟"按任意键继续?"

我正在尝试编写一个C++程序,当用户从键盘输入任何字符时,它应该移动到下一行代码.

这是我的代码:

char c;

cin>>c;

cout<<"Something"<<endl;
Run Code Online (Sandbox Code Playgroud)

但这不起作用,因为当我输入一些字符然后按ENTER键时它只会移动到下一行.

要么

如果我用这个

cin.get() or cin.get(c)
Run Code Online (Sandbox Code Playgroud)

按Enter键进入下一行指令.

但我希望它能够在键盘上按下的任何键上移动到下一行,如何做到这一点?

c++

78
推荐指数
7
解决办法
13万
查看次数

用ruby中的数字连接字符串

我是红宝石的初学者,所以这是一个非常新手的问题.

我试图连接一个字符串与浮动值,如下所示,然后打印它.

puts " Total Revenue of East Cost: " + total_revenue_of_east_cost 
Run Code Online (Sandbox Code Playgroud)

total_revenue_of_east_cost是一个保持浮点值的变量,我怎样才能打印?

ruby

66
推荐指数
4
解决办法
8万
查看次数

如何在地图片段API v2布局顶部添加按钮

我正在尝试使用API​​ v2在android中显示地图.
我想要UI这样的东西.但是每当我尝试在布局中添加按钮时它不会反映在输出中
我能够获得没有按钮的地图.
我需要按钮与地图集成,如下面
的Mylayout.xml代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<LinearLayout 
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioGroup 
android:id="@+id/radio_group_list_selector"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:layout_weight="1"

>
<RadioButton
android:id="@+id/radioPopular"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="@string/Popular"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/shape_radiobutton"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="4dp"
android:textColor="@drawable/textcolor_radiobutton"

/>
<View
android:id="@+id/VerticalLine"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:background="#aaa"
            />
<RadioButton
android:id="@+id/radioAZ"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="@string/AZ"
android:layout_weight="1"
android:button="@null"
android:background="@drawable/shape_radiobutton2"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:textColor="@drawable/textcolor_radiobutton"

/>
 <View
android:id="@+id/VerticalLine"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:background="#aaa"
            />
<RadioButton
android:id="@+id/radioCategory"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="@string/Category" …
Run Code Online (Sandbox Code Playgroud)

android google-maps android-layout android-button

64
推荐指数
2
解决办法
10万
查看次数

非正式协议在Objective-C?

我想知道是否有人可以解释Objective C中的非正式协议?我尝试在苹果文档和其他一些书籍上理解它,但我的头仍在旋转,所以如果有人可以用例子来解释,我将非常感激.

谢谢.

objective-c

51
推荐指数
4
解决办法
2万
查看次数

在C程序中的Xcode中给出命令行参数

我正在Xcode中解决我的C赋值,在该程序中我必须在运行程序时给出命令行参数,为此我必须使用这样的用户终端:

./a.out myfirstCommand mySecondCommand
Run Code Online (Sandbox Code Playgroud)

我想知道是否有可能在xcode中提供这些命令而不是去终端.谢谢

c xcode command-line

48
推荐指数
5
解决办法
5万
查看次数