问题列表 - 第42129页

Monotouch打开文档 - UIDocumentInterationController

我想在我用iotouch编写的iphone应用程序上打开一个文档 - 即在默认的PDF查看器中启动PDF文件.

我想我应该使用UIDocumentInterationController?

任何人对此都有任何想法..

我在viewcontroller上放了以下内容(带工具栏)

但它不起作用:-(它什么都不做!

string s = string.Format("{0}",strFilePath);

NSUrl ns = NSUrl.FromFilename (s);   

UIDocumentInteractionController PreviewController =
   UIDocumentInteractionController.FromUrl(ns);
PreviewController.Delegate =  new UIDocumentInteractionControllerDelegateClass();
PreviewController.PresentOpenInMenu(btnOpen,true);
Run Code Online (Sandbox Code Playgroud)

  public class UIDocumentInteractionControllerDelegateClass : UIDocumentInteractionControllerDelegate
                {
                     public UIViewController FileViewController = new UIViewController();
                    public UIDocumentInteractionControllerDelegateClass ()
                    {
                    }

                    public override UIViewController ViewControllerForPreview (UIDocumentInteractionController controller)
                    {
                        return FileViewController;    
                    }

                    public override UIView ViewForPreview (UIDocumentInteractionController controller)
                    {
                        return FileViewController.View;
                    }
                }
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch xamarin.ios

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

在MATLAB GUI中打破for循环

for在MATLAB的GUI的打开功能中有一个循环,我正在尝试使用回调按钮来打破循环.我是MATLAB的新手.这是我的代码:

%In the opening function of the GUI
handles.stop_now = 0;
for i=1:inf
   if handles.stop_now==1
      break;
   end
end


% Executes on button press 
function pushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to end_segmenting_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.stop_now=1;
guidata(hObject, handles);
Run Code Online (Sandbox Code Playgroud)

出于某种原因,尽管使用句柄定义变量,但按下按钮时循环不会中断.有谁知道发生了什么?谢谢.

matlab user-interface

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

如何使用Android中的buttonclick以编程方式切换选项卡

我几天来一直在努力解决这个问题.我试图在按钮点击时以编程方式切换标签.如果我只使用选项卡来更改活动,我的程序将完美运行,但使用setCurrentTab连接onClick方法会导致错误.这是不起作用的方法.这是一个非常基本和简单的功能,但我没有看到很多文档或人们试图用切换标签连接按钮的例子.谢谢.

ImageButton next = (ImageButton) findViewById(R.id.ButtonAsk);
 next.setOnClickListener(new View.OnClickListener() 
         {         
  public void onClick(View view)  
             {

                TabHost tabHost =  (TabHost) findViewById(android.R.id.tabhost);
              tabHost.setCurrentTab(2);                
             }
         });
Run Code Online (Sandbox Code Playgroud)

请参阅错误日志的编辑历史记录.

java tabs android onclick android-tabhost

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

注释中的PHP类功能列表

每当我用PHP编写一个类时,我都喜欢在类的顶部放置一个公共函数列表,如下所示:

// add_project($apikey, $post, $email)
// create_user($apikey, $email, $firstname, $lastname, $rolename, $pid)     
// user_join_project($apikey, $email, $pid)
Run Code Online (Sandbox Code Playgroud)

我想知道是否有任何工具可以自动化这个过程.也许我可以加载类文件,它可以生成函数名称,变量等列表?

谢谢!

php class function

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

c ++读取指针的内容

我是c ++世界的新手,我只是将它用于帮助我工作的litle应用程序,现在,我需要阅读文件夹的内容,列出文件夹内容,我已经创建了一个返回指针的函数文件夹中每个obj的名称,但现在,我不知道如何读取指针的内容只是在控制台中打印它,我的函数看起来像这样

string* listdir (const char *path)
{
    string* result = new string[50]; // limit to 50 obj
    DIR *pdir = NULL;
    pdir = opendir (path);
    struct dirent *pent = NULL;
    if (pdir == NULL)
    { 
        printf ("\nERROR! pdir could not be initialised correctly");
        return NULL;
    } 
    int i = 0;
    while (pent = readdir (pdir))
    {
        if (pent == NULL)
        {
            printf ("\nERROR! pent could not be initialised correctly");
            return NULL;
        }
        //printf ("%s\n", pent->d_name);
        result[i++]= pent->d_name;
    }

    closedir …
Run Code Online (Sandbox Code Playgroud)

c++ pointers

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

让factory_girl在Rails3中工作

对于我的生活,我无法factory_girl在Rails3中工作.我创建了一个全新的应用程序.我的Gemfile:

gem "rspec"
gem "rspec-rails"
gem "factory_girl_rails"
Run Code Online (Sandbox Code Playgroud)

application.rb像这样的发电机:

  config.generators do |g|
      g.test_framework :rspec, :fixture => true, :views => false, :fixture_replacement => :factory_girl
  end
Run Code Online (Sandbox Code Playgroud)

然后,使用生成器创建新模型:

> rails g model Addon name:string

  invoke  active_record
  create    db/migrate/20101223205918_create_addons.rb
  create    app/models/addon.rb
  invoke    rspec
  create      spec/models/addon_spec.rb
   error      factory_girl [not found]
Run Code Online (Sandbox Code Playgroud)

我想念什么?我bundle install当然跑了...我试着环顾四周,但在factory_girl和rails3上找不到任何体面的文档.

rspec ruby-on-rails-3 factory-bot

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

GWT CellList还是Cell Table?

我想显示一些与ebay样式等产品相关的数据,其中包含用户可以点击产品的行中的产品信息.这是在gwt中使用的最好的小部件吗?

java gwt widget

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

C#WPF限制Listview中每行的项目

我的清单视图:

<ListView ItemTemplate="{StaticResource GridViewItemTemplate}" Name="gridView_movies">
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"  VerticalAlignment="Top"/>
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
</ListView>
Run Code Online (Sandbox Code Playgroud)

列表的数据模板:

<DataTemplate x:Key="GridViewItemTemplate">
    <StackPanel Orientation="Vertical" >
        <Image Width="250" Height="290" Source="{Binding Image}"/>
        <TextBlock Text="{Binding Title}" HorizontalAlignment="Center"  VerticalAlignment="Top" FontSize="20"/>
    </StackPanel>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)

当我加载这个,所有项目都显示在一行,我的问题是,我怎么能每行只显示3个项目而不是一行中的所有项目.

感谢您的关注.

c# wpf xaml listview

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

开源Google App Engine Django项目的好例子

我正在寻找一个基于Django/python的Google App Engine应用程序的好例子来使用学习工具.

我看过其他一些帖子,它们主要是基于Java的,而不是我真正想要的.

有什么建议?

先感谢您,

肯特

python django google-app-engine

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

通用接口的通用列表不允许,任何替代方法?

我试图找到使用通用接口通用列表作为变量的正确方法.

这是一个例子.这可能不是最好的,但希望你能明白这一点:

public interface IPrimitive<T>
{
     T Value { get; }
}
Run Code Online (Sandbox Code Playgroud)

然后在另一个类中,我希望能够声明一个包含实现IPrimitive<T>任意对象的列表的变量T.

// I know this line will not compile because I do not define T   
List<IPrimitive<T>> primitives = new List<IPrimitives<T>>;

primitives.Add(new Star());   // Assuming Star implements IPrimitive<X>
primitives.Add(new Sun());    // Assuming Sun implements IPrimitive<Y>
Run Code Online (Sandbox Code Playgroud)

需要注意的是,TIPrimitive<T>可能是列表中的每个条目不同.

关于如何建立这种关系的任何想法?替代方法?

c# generics interface generic-list

24
推荐指数
2
解决办法
8306
查看次数