小编Atm*_*tma的帖子

在不使用cocoa中的接口构建器的情况下调用uibutton的动作方法

我正在通过将按钮拖动到界面构建器中的视图来调用对象中的操作方法.然后我将一个对象拖到面板上,并使用action方法指定我的对象.我将我的按钮拖动到对象并选择我的操作方法.这适用于调用我的方法.

我想在没有uiview类的接口构建器的情况下调用我的action方法,而当前的nib是从uiview类派生的.

有谁知道我怎么能做到这一点?

iphone cocoa-touch objective-c

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

在iPhone上对双精度数组或CLLocationDistance值进行排序

我正在尝试CLLocationDistance按最近距离(升序)对值列表进行排序.我首先将值转换为NSString对象,以便我可以使用以下排序:

NSArray *sortedArray;
sortedArray = [distances sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
Run Code Online (Sandbox Code Playgroud)

NSString无法对数值进行排序.

如何按升序设置数值列表?

arrays iphone cocoa-touch objective-c

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

-fno-objc-arc标志设置但ARC转换仍在尝试转换iOS中的文件

我正在尝试将我的项目转换为arc.我已经为要从arc中排除的所有文件设置了-fno-objc-arc.然后我去编辑>转换为objective-c arc,转换过程仍尝试转换它们.他们没有转变,也没有让我前进.

有谁知道我可以做什么让转换过程识别我的不转换标志(-fno-objc-arc)?

谢谢!

xcode automatic-ref-counting

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

不要忽略git sourcetree中的文件

我正在从源代码树下载一个eclipse项目.未签入.project和.classpath文件.我希望这些文件已成功导入.我没有gitignore文件.任何人都可以解释为什么这些文件没有出现?

我还查看了检查这些文件的源机器,文件就在那里.在该计算机上的sourcetree版本中,它不再显示要检入的文件.

My exlude file looks like this:
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store
Run Code Online (Sandbox Code Playgroud)

这似乎不是这种情况.

谢谢!

git version-control gitignore atlassian-sourcetree

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

接收错误:使用参数'()'和未找到的关键字参数反转

我在Django模板中创建链接时出错.

我的模板看起来像这样:

<a href="{% url 'location_detail' pk=location.id %}">{{ location.name }}</a>
Run Code Online (Sandbox Code Playgroud)

我的urls.py看起来像:

url(r'^location(?P<pk>\d+)/$', views.location_detail, name="location_detail"),
Run Code Online (Sandbox Code Playgroud)

我的观点如下:

def location_detail(request, pk=None):
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Reverse for views.location_detail with arguments '()' and keyword arguments '{u'pk': 1L}' not found.
Run Code Online (Sandbox Code Playgroud)

我正在使用Django 1.5和python 2.7.2

谢谢!

python django django-templates django-urls

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

如何使parse.com对象属性唯一?

我具有PFUser需要唯一的对象的属性。

例如,默认电子邮件字段是唯一的,当不符合条件时会引发异常并带有警报。

如何将此字段设置为唯一?

ios parse-platform

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

如何从命令行运行django python文件

我有一个简单的python文件,我最终想从chron运行.

它看起来像这样:

from customers.models import Customer, NotificationLogEntry


def hello():
    customers =  Customer.objects.all()
    for c in customers:
        log_entry = NotificationLogEntry(
                                          customer=c,
                                          sent=True,
                                          notification_type=0,
                                          notification_media_type=0,
                                          )
        log_entry.save()


if __name__ == '__main__':
    hello()
Run Code Online (Sandbox Code Playgroud)

当我运行这个:

python notifications.py
Run Code Online (Sandbox Code Playgroud)

我收到导入错误:

Traceback (most recent call last):
  File "notifications.py", line 1, in <module>
    from customers.models import Customer, NotificationLogEntry
ImportError: No module named customers.models
Run Code Online (Sandbox Code Playgroud)

这个模块存在,我在我的django应用程序中没有任何问题地调用它.为什么我在应用程序之外收到此错误?

python django

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

在django timefield中将输入设置为AM PM

我想让用户能够在我的django时间段上午和下午之间进行选择

目前,如果我输入:

11:00 AM

,我收到一个表单错误:"输入一个有效的时间."

如果我输入:

11:00

表单验证没有问题.

我也尝试过:

class RemindersForm(forms.ModelForm):

    remdinder = forms.TimeField(input_formats='%H:%M %p',)

    class Meta:
        model = NotificationPreference
        fields = (
                  'reminder', 
                  )
Run Code Online (Sandbox Code Playgroud)

这会将输入格式更改为:

11:00:00

并仍然给我上述验证错误.

我究竟做错了什么?

django django-models django-forms timefield

4
推荐指数
3
解决办法
5801
查看次数

android webview超过全宽响应网站

我有一个简单的webview:

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />
Run Code Online (Sandbox Code Playgroud)

这被称为:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView myWebView = (WebView) findViewById(R.id.webview);
        myWebView.loadUrl("http://example.com");
    }
Run Code Online (Sandbox Code Playgroud)

问题是我尝试渲染的网站没有进入响应模式.宽度超出屏幕,导致我滚动.

我尝试过宽度,包括:fill_parent,match_parent和wrap_content,但没有一个工作.

我可以做些什么来使网页呈现响应,保持在屏幕的范围内而不水平滚动?

css android webview

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

iOS 中的 UILocalNotification 中不显示操作和类别

我有以下内容,我相信这里的苹果文档是我需要的所有类别UILocalNotification

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {


    UIMutableUserNotificationAction *acceptAction =
    [[UIMutableUserNotificationAction alloc] init];

    // Define an ID string to be passed back to your app when you handle the action
    acceptAction.identifier = @"ACCEPT_IDENTIFIER";

    // Localized string displayed in the action button
    acceptAction.title = @"Accept";

    // If you need to show UI, choose foreground
    acceptAction.activationMode = UIUserNotificationActivationModeBackground;

    // Destructive actions display in red
    acceptAction.destructive = NO;

    // Set whether the action requires the user to authenticate
    acceptAction.authenticationRequired …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c ios uilocalnotification appdelegate

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