小编Ale*_*ger的帖子

ConvertRect计算UIScrollView zoom和contentOffset

我一直在尝试在UIScrollView中获得UIView的转换后的CGRect.如果我没有放大,它可以正常工作,但一旦我缩放,新的CGRect就会移动.这是让我接近的代码:

CGFloat zoomScale = (scrollView.zoomScale);    
CGRect newRect = [self.view convertRect:widgetView.frame fromView:scrollView];
CGPoint newPoint = [self.view convertPoint:widgetView.center fromView:scrollView];

//  Increase the size of the CGRect by multiplying by the zoomScale
CGSize newSize = CGSizeMake(newRect.size.width * zoomScale, newRect.size.height * zoomScale);
//  Subtract the offset of the UIScrollView for proper positioning
CGPoint newCenter = CGPointMake(newPoint.x - scrollView.contentOffset.x, newPoint.y - scrollView.contentOffset.y);

//  Create rect with the proper width/height (x and y set by center)
newRect = CGRectMake(0, 0, newSize.width, newSize.height);    

[self.view addSubview:widgetView];

widgetView.frame = …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios ios5

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

除非手动执行,否则Elastic Beanstalk上的“ npm install”将失败

我有一个带有PHP应用程序的Elastic Beanstalk环境。我想npm install在部署应用程序后立即运行。

node并且npm都通过deploy configs安装在服务器上。我已经定义了一个容器命令,将其简单地cd到正确的目录中,然后运行npm install,但是它always失败,并出现相同的错误。

如果我手动执行npm install,那么一切都将完美安装。

我该如何调试呢?

deploy.config

commands:
    01_mkdir_webapp_dir:
      # use the test directive to create the directory
      # if the mkdir command fails the rest of this directive is ignored
      test: 'mkdir /home/webapp'
      command: 'ls -la /home/webapp'
    02_chown_webapp_dir:
      command: 'chown webapp:webapp /home/webapp'
    03_chmod_webapp_dir:
      command: 'chmod 700 /home/webapp'
    04_node_install:
        cwd: /tmp
        test: '[ ! -f /usr/bin/node ] && echo "node not installed"'
        command: 'yum install -y …
Run Code Online (Sandbox Code Playgroud)

linux node.js npm amazon-elastic-beanstalk

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

表格随机处理

Protected Overrides Sub LoadForm()
    MyBase.LoadForm()
    Try
        'StartProcess might be causing an error (error msg is issue with loading config, which would be incorrect)
        StartProcess()
        Dim D As New _Delegate(AddressOf SOPERATION)
        Me.Invoke(D)
        BusinessObject = New bConfig(Me)
        CType(BusinessObject, bConfig).LoadKeyValue()
    Catch ex As Exception
        MESSAGES.ShowMessage(MessageIndex.ErrInLoadConfigData, TitleIndex.LoadForm, MessageBoxButtons.OK, MessageBoxIcon.Information)
        StopProcess()
        EnableDisable(CurrentBillType)
    End Try
End Sub
Run Code Online (Sandbox Code Playgroud)

我可以在完全相同的条件下运行100次,看起来像是40次会因以下错误而崩溃:

"无法访问已处置的对象.对象名称:'frmImportExport'."

它要么死了

'within StartProcess()
    Dim __Delegate As New _Delegate(AddressOf StartProcess)
    Me.Invoke(__Delegate)
Run Code Online (Sandbox Code Playgroud)

要么

Dim D As New _Delegate(AddressOf SOPERATION)
Run Code Online (Sandbox Code Playgroud)

我知道在没有看到整个代码的情况下很难回答,但我不能为我的生活找出为什么有时这样做,有时在相同条件下不起作用.关于我能找到什么的任何想法?在我看到的任何地方都没有手动处理论坛,而且这个代码正在formload上执行.


附加信息:

StackTrace:"在ShiftBilling上的System.Windows.Forms.Control.Invoke(Delegate方法,Object [] args)中的System.Windows.Forms.Control.MarshaledInvoke(Control caller,Delegate方法,Object [] args,布尔同步). C:\ Users …

.net vb.net dispose winforms

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

容器视图控制器与childViewControllers的通信

我有一个容器视图控制器,带有3个子UIViewController子类(添加了addChildViewController).我希望我的一个子视图控制器在从容器视图控制器上删除某些内容时执行某些操作.我无法理解这种沟通应该如何发生.如果我尝试创建一个委托,我的子视图控制器中会出错,因为我会将两个子类互相导入.

cocoa-touch delegates uiviewcontroller ios

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