小编Joe*_*Joe的帖子

UIAlertView代表

有人可以解释代表如何UIAlertView工作?是自动调用还是必须调用它?例如:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

iphone cocoa-touch objective-c

20
推荐指数
3
解决办法
3万
查看次数

如何在我的活动中获得颜色资源的值

我需要获取颜色的字符串值.换句话说,我想#ffffffff从像<color name="color">#ffffffff</color>字符串格式的颜色资源中拉出来.有没有办法做到这一点?

string android colors

7
推荐指数
1
解决办法
9567
查看次数

Java trackpad 2指滚动监听器

如何在java中的笔记本电脑触控板上检测到双指滚动?我一直在搜索谷歌和这里,但在使用触控板滚动时找不到任何内容,更不用说如何倾听它了.任何帮助将不胜感激.谢谢.

java scroll trackpad listener

7
推荐指数
2
解决办法
4530
查看次数

如何在objective-c中传递字符串作为方法参数?

我试图在objective-c中编写我的第一个类,我想在类的方法中传递NSString对象作为参数,但是我得到一个错误,说"不能使用对象作为方法的参数".所以我的问题是如何将字符串作为参数传递给方法?这是我的代码我试图开始工作:

#import <Foundation/Foundation.h>

@interface Car
{
    NSString *color;
    NSString *make;
    int year;
}    

- (void) print;
- (void) setColor: (NSString) c;
- (void) setMake: (NSString) m;
- (void) setYear: (int) y;


@end

@implementation Car

- (void) print
{
    NSLog(@"The $d Ford %@ is $@.", year, make, color);
}

- (void) setColor: (NSString) c
{
    color=c;
}

- (void) setMake: (NSString) m
{
    make=m;
}

- (void) setYear: (int) y
{
    year=y;
}


@end



int main (int argc, const char * …
Run Code Online (Sandbox Code Playgroud)

objective-c

6
推荐指数
1
解决办法
1万
查看次数

在xcode中更改设备方向时,如何加载xib?

当设备的方向改变时,我将如何加载新的xib?即,当设备变为横向时加载横向导向的xib,反之亦然,纵向加载.以及如何自动检测方向变化并从那里进行调整?

cocoa-touch objective-c

6
推荐指数
1
解决办法
3090
查看次数

javascript是否需要';' 在一行代码的末尾?

我已经看到并使用了javascript代码,它们都有和省略';' 从陈述结束.它们在某些情况下是否需要而在其他情况下不需要 如果是这样,你可以提供一些例子,如果不是通用标准,那么使用';' 还是不......那个问题是什么?

javascript

6
推荐指数
1
解决办法
2255
查看次数

我如何在可可/ objective-c中获得触摸的位置?

我希望获得触摸的位置,最好对应于屏幕的像素.我是Objective-c和cocoa的新手,并且无法在网上找到关于此的任何内容,所以我不确定是否有办法做到这一点.任何想法或方向看哪里都会有所帮助.谢谢.

iphone cocoa-touch objective-c uikit

4
推荐指数
1
解决办法
5658
查看次数

在objective-c/cocoa touch中将触摸的视图带到前层

所以我想要做的是当触摸任何给定的UIView,并在窗口周围移动时,将其带到前面并位于所有其他层的顶部.有没有办法以编程方式执行此操作?

cocoa-touch objective-c

4
推荐指数
1
解决办法
3993
查看次数

UIDeviceOrientation*orientation = [UIDevice currentDevice] .orientation; 获得"初始化中不可比的类型"错误

任何人都可以告诉我为什么这行会抛出不兼容的类型错误?

UIDeviceOrientation *orientation = [UIDevice currentDevice].orientation;
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c

0
推荐指数
1
解决办法
835
查看次数

找不到这个NullPointerException

我不断得到一个Unable to instantiate activity ComponentInfo... Caused by a NullPointerException at findViewById,我不知道它为什么扔它.我在我的设备中正确设置了我的元素ID,main.xml并且我已经尝试在每个线周围注释,看看哪条线有问题,但要让它运行w/o任何力量关闭我必须注释掉所有的功能程序.这是我的活动:

package fsg.dev.test.checkboxtest;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.SeekBar;

public class checkBoxTest extends Activity {
    private CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
    //private SeekBar seekbar = (SeekBar) findViewById(R.id.seekbar);
    private View view = (View) findViewById(R.id.background);

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked){
            changeColor();
        }
    });
}

private void changeColor(){
    if(checkbox.isChecked()){
        view.setBackgroundColor(R.color.Blue); …
Run Code Online (Sandbox Code Playgroud)

android nullpointerexception android-manifest android-layout

0
推荐指数
1
解决办法
2527
查看次数

布局元素没有显示出来

我有两个活动,第一个是正确生成,但第二个不是.只显示xml文件中的第一个元素.这是我的xml文件:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/alternateActivity"
    android:shadowColor="@color/shadowColor"></TextView>
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/oldActivityButton"
    android:text="@string/oldActivityButton"></Button>
<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/changeText"
    android:text="@string/changeTextButton"></Button>
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/originalText" 
    android:id="@+id/textToChange"></TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的活动对应:

package fsg.dev.activitytest;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class newActivity extends Activity {
private Button oldActivityButton;
private Button changeText;
private TextView textToChange;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.alternate);

        oldActivityButton = (Button) findViewById(R.id.oldActivityButton);
        changeText = (Button) findViewById(R.id.changeText);
        textToChange = (TextView) findViewById(R.id.textToChange);

        oldActivityButton.setOnClickListener(new OnClickListener(){ …
Run Code Online (Sandbox Code Playgroud)

xml layout android

0
推荐指数
1
解决办法
2923
查看次数

我的代码有什么问题吗?

-(void)processGlyph:(int)glyphOne withGlyph:(int)glyphTwo
{
    answer = glyphOne + glyphTwo;
    NSString *tempText = [[NSString alloc] init];
    tempText = [NSString stringWithFormat:@"%i",answer];
    [self dispatchText:tempText];
    [tempText release];
}

-(void)checkReadyToProcess
{
    if (count >= 2) {
        [self processGlyph:firstGlyph withGlyph:secondGlyph];
    }
}

-(void)dispatchText:(NSString *) theText
{
    answerText.text = theText;
}
Run Code Online (Sandbox Code Playgroud)

objective-c

-1
推荐指数
1
解决办法
105
查看次数