问题列表 - 第9975页

不知道为什么UIView被大约10px轻推

我创建了一个简单的iPhone应用程序,它有两个.xib文件.在应用程序中的app委托确实完成启动我通过调用显示第一个.xib文件:

[window addSubview:myView];
Run Code Online (Sandbox Code Playgroud)

我在IBAction上为UIButton做同样的事情,将视图更改为myView2.

我发现,当我运行应用程序时,对于两个视图都有一个大约10像素的白条.我还注意到按钮偏移了10个像素(大约).所以我得到的结论是,视图从屏幕上的10个像素开始显示并且结束时间短.

知道为什么会这样,我如何解决它,或者我如何进一步调试正在发生的事情?我检查了我的.xib文件,他们正在消耗设备的整个高度(即没有白条),所以这看起来是XCode内部的一个问题.

编辑:我已经把问题缩小了一点.我正在使用两种方法来加载子视图.当我加载第一个视图里面的applicationDidFinishLaunching一切都很好.但是,如果我更换了两条消息window[self originalView]方法,那么一切都有点失控.

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    //[self originalView];  <- I want to use this instead of the following two lines

    // Override point for customization after app launch    
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

}

-(void)endView{
    endV = [[EndViewController alloc] initWithNibName:@"EndView" bundle:nil];
    [window removeFromSuperview];
    [window addSubview:endV.view];  
}
-(void)originalView{
    viewController = [[MyAppViewController alloc] init];
    [window removeFromSuperview];
    [window addSubview:viewController.view];

}
Run Code Online (Sandbox Code Playgroud)

从我所看到的,我总是调用相同的代码行,无论它是在内部applicationDidFinishLaunching还是在内部,[self originalView]但它似乎window变成了一个不同的对象.

iphone xcode window xib uiview

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

对jQuery使用的批判

我正忙着通过实现一个小系统向jQuery介绍自己,其中onmouseover在一个元素上导致文本气球弹出靠近元素.我觉得我在这里使用过多的香草JS,所以请建议我可以改进的地方以及这段代码有什么问题:

<head runat="server">
    <script type="text/javascript" src="Scripts/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $('document').ready(function() {
            $('span.balloon').each(function() {
                this.style.display = "none";        
            });      

            $('span.ballooned').mouseover(function(event){
                if (event.currentTarget.attributes["balloonid"]) {
                    var blnArr = $("#" + event.currentTarget.attributes["balloonid"].value);
                    if (blnArr.length > 0) {
                        blnArr[blnArr.length - 1].style.display = "inline";                    
                    };
                };
            });
        });
    </script>
</head>
<body>
    <div>
        This is some text where I describe a <span class="ballooned" balloonId="bln-1">text field</span> and want to attach extra info to that phrase.
    </div>
    <span class="balloon" id="bln-1">nvarchar(8)</span>
</body>
Run Code Online (Sandbox Code Playgroud)

javascript jquery

3
推荐指数
2
解决办法
882
查看次数

如何找出我的servlet中推送的HTML按钮?

我正在创建一个包含两个提交按钮的注册表单.我需要知道在我的servlet代码中单击哪个按钮?

html java jsp button

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

如何在modelform中给出初始值

如何为ModelForm中的字段分配初始值?例如:

class Form1(forms.Form):
    title=forms.CharField(initial="hello")
Run Code Online (Sandbox Code Playgroud)

使用modelForm的等价物的基本语法是这样的:

class Form2(djangoforms.ModelForm):
    class Meta:
        model=SomeModel
        fields=('title',)
Run Code Online (Sandbox Code Playgroud)

我想要做的是生成一个CRUD.由于我在一个appengine项目中这样做,我不能使用通用视图.Appengine为我们提供了djangoforms.ModelForm与django一样的工作,ModelForm但使用了appengine的数据存储.

我需要以上功能来执行"编辑"部分.

django google-app-engine

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

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

将文本垂直对齐到UILabel中的顶部

我有UILabel两行文字的空间.有时,当文本太短时,此文本显示在标签的垂直中心.

如何将文本垂直对齐以始终位于顶部UILabel

表示具有垂直居中文本的UILabel的图像

xcode cocoa-touch text-alignment uikit ios

2141
推荐指数
39
解决办法
64万
查看次数

是否可以在安装后编辑/修改firefox插件?

是否可以修改/编辑已安装的firefox插件?存储在计算机中的插件在哪里...我的意思是哪个文件夹等...

firefox firefox-addon

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

将枚举转换为迭代器

我有以下隐式转换 java.util.Enumerations

   implicit def enumerationIterator[A](e : Enumeration[A]) : Iterator[A] = {
     new Iterator[A] {
        def hasNext = e.hasMoreElements
        def next = e.nextElement
        def remove = throw new UnsupportedOperationException()
     }
   }
Run Code Online (Sandbox Code Playgroud)

不幸的是它不起作用,ZipFile.entries因为它返回一个Enumeration<? extends ZipEntry>(参见相关问题)并且Scalac一直告诉我

type mismatch; found : java.util.Iterator[?0] 
   where type ?0 <: java.util.zip.ZipEntry 
   required: Iterator[?]
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何使对话工作.喜欢

List.fromIterator(new ZipFile(z).entries))
Run Code Online (Sandbox Code Playgroud)

generics iterator enumeration scala type-inference

5
推荐指数
1
解决办法
3634
查看次数

暂时将STDOUT重定向到/ dev/null - 不能一直工作

我在用

Server version: Apache/1.3.34 (Debian)
mod_perl - 1.29
Run Code Online (Sandbox Code Playgroud)

通过引用STDIN,STDOUT和STDERR Streams

#!/usr/bin/perl5
package main;

use strict 'vars';

{
    # Our mighty holy legacy code love to print out message in the middle of operation. Shihh....
    # Let's quietly redirect those message to /dev/null.
    my $nullfh = Apache::gensym( );
    open $nullfh, '>/dev/null' or warn "Can't open /dev/null: $!";
    local *STDOUT = $nullfh;
    print "BYE BYE WORLD";    # Shouldn't show in webpage.
    close $nullfh;
}

print "X BEGIN HELLO WORLD";  # Should …
Run Code Online (Sandbox Code Playgroud)

printing perl buffer

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

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