小编Kli*_*akM的帖子

UITableView:以编程方式更改页脚视图的大小不起作用

我的表格视图的页脚是一个显示来自用户的一些推文的视图,所以在得到推文之前我不知道它的高度,我创建了一个FooterViewController有方法refreshTweets,我添加它viewDidLoad:

FooterViewController *controller = [[FooterViewController alloc] initWithNibName...];
[[self tableView] setFooterView:[controller view]];
[controller refreshTweets];
Run Code Online (Sandbox Code Playgroud)

refreshTweets方法中,我阅读推文并计算总高度,并重置视图(页脚)的高度:

self.view.frame = newFrame;
Run Code Online (Sandbox Code Playgroud)

但它没有意义,页脚的高度仍然是我在Interface Builder中设置的高度,是否有任何遗漏或任何替代方法这样做?

谢谢!

编辑:我可以在界面构建器中将视图的大小更改为足够小,并且在计算推文的高度和设置view.frame后它会被放大,但是表格视图仍然认为其页脚具有先前的高度,即额外的空间在桌面视图之外,如果我将桌子向上拖动,我只能看到它.

footer frame uitableview uiview tweets

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

构建后MsBuild复制文件

我想bin\Debug在构建项目后从主目录复制一个xml文件,但我的解决方案不起作用.我编辑了.csproj文件并添加了:

<Target Name="AfterBuild">
     <Copy SourceFiles="Controllers.xml" DestinationFolder="\bin\Debug" ContinueOnError="true" />
</Target>
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?构建成功.

.net msbuild build csproj visual-studio-2010

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

在UINavigationController中,topViewController,visibleViewController,presentsViewController有什么区别?

UINavigationController有3个控制器,所有的声音非常相似的对我说:topViewController,visibleViewController,和presentedViewController.

您在哪些场景中使用这些控制器?

objective-c uiviewcontroller uinavigationcontroller ios swift

20
推荐指数
2
解决办法
5088
查看次数

在自定义.plist文件中使用用户定义的构建设置

我为我的应用程序定义了不同的构建配置(Debug,Stage,Prod),并使用用户定义的构建设置:

在此输入图像描述

Info.plist文件中设置Facebook登录和其他内容:

在此输入图像描述

在这种情况下,$(USER_DEFINED_SETTINGS)符号确实有效.

当我尝试设置Google SignIn时,需要使用其他.plist文件(GoogleService-Info.plist),并且我使用与文件相同的方式使用用户自定义设置Info.plist,但它不起作用.

如何在自定义文件中使用用户定义的设置.plist?如果我不能,我该如何解决这个问题?

xcode plist ios google-signin

20
推荐指数
2
解决办法
6034
查看次数

检查密码上次更改的时间

如何检查某个用户上次更改密码的时间?我想在Windows和Linux上都这样做,你能指导一下我该怎么办?

linux windows passwords maintenance admin

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

在iOS 7中使用iOS 6 Style Segmented Control?

iOS 7设备上的分段控件是否可以显示为iOS 6版本的控件?

我们还没有为接口重新设计做好准备,而新的平板控制与其他用户界面并不相符.如果可能的话,现在最好保留iOS 6风格.

为了澄清,我正在使用iOS 6.1 Base SDK进行编译.我知道这是我问题的"明显"答案,但它不起作用.大多数其他UI元素将通过这样做显示iOS 6样式,但是像UIAlertViewUIActionSheet,而UISegmentedControl不是.但是,不像UIAlertViewUIActionSheet,UISegmentedControls不喜欢"系统"项目; 他们应该能够在iOS 6模式下显示.

编辑:我认为如果我最终包含一张图片(可能应该从一开始就做到这一点)会有所帮助.但是,我提供的答案确实解决了这个问题.另外,回想起来,看起来这可能是iOS 6风格,它只是显示错误,看起来像iOS 7风格.

在此输入图像描述

uisegmentedcontrol ios ios6 ios7

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

Android - 从WebView绘制到PDF画布

我一直在Android上进行PDF打印工作时遇到麻烦.我要做的是在WebView中渲染一些HTML,然后在PDF画布上绘制WebView内容,最后将PDF写入文件.我遇到的问题是,当我绘制到PDF画布时,即使有足够的画布,内容也会被剪裁.我已经尝试使用这种工具来调整画布大小,.clipRect(Rect rect, Op op)但这种工作并不像我喜欢的那样好.

我也不知道如何将HTML px测量值可靠地转换为PDF PostScript 1/72英寸测量值.

这是我正在使用的代码:

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

    WebView wv = (WebView) this.findViewById(R.id.webView1);

    wv.loadUrl("file:///android_asset/temp.html");           
}

public void button1onClick(View v)
{
    //Create PDF document
    PdfDocument doc = new PdfDocument();

    //Create A4 sized PDF page
    PageInfo pageInfo = new PageInfo.Builder(595,842,1).create();

    Page page = doc.startPage(pageInfo);

    WebView wv = (WebView) this.findViewById(R.id.webView1);

    page.getCanvas().setDensity(200);

    //Draw the webview to the canvas
    wv.draw(page.getCanvas());

    doc.finishPage(page);

    try
    {
        //Create the PDF file
        File root = Environment.getExternalStorageDirectory();          
        File file = …
Run Code Online (Sandbox Code Playgroud)

pdf android webview android-canvas

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

在iOS 8上显示NSMutableAttributedString

iOS 8.0(12A365)上的似乎NSMutableAttributedString有时无法正确显示.当属性的范围不在文本的开头(并且如果在文本的开头没有其他属性开始)时,显然会出现问题.

所以1.)第二个单词"green"将不显示绿色背景(bug!)("cell"是UITableViewCell带有UILabel"label"作为子视图):

1.)

text = [[NSMutableAttributedString alloc] initWithString:@"Green is green. (-> Bug)"];
[text addAttribute:NSBackgroundColorAttributeName value:[UIColor greenColor] range:(NSRange){9,5}];
cell.label.attributedText=text
Run Code Online (Sandbox Code Playgroud)

使用2.)和3.)正确显示背景:

2.)

text = [[NSMutableAttributedString alloc] initWithString:@"Green is green. (-> Ok)"];
[text addAttribute:NSBackgroundColorAttributeName value:[UIColor greenColor] range:(NSRange){0,5}];
[text addAttribute:NSBackgroundColorAttributeName value:[UIColor greenColor] range:(NSRange){9,5}];
cell.label.attributedText=text
Run Code Online (Sandbox Code Playgroud)

3.)

text = [[NSMutableAttributedString alloc] initWithString:@"Green is green. (-> Ok)"];
[text addAttribute:NSBackgroundColorAttributeName value:[UIColor greenColor] range:(NSRange){0,5}];
cell.label.attributedText=text
Run Code Online (Sandbox Code Playgroud)

在此处查找屏幕截图和XCode 6项目:屏幕截图和XCode 6项目

对我来说似乎是iOS 8中的一个错误 - 所以报告发给Apple.

uitableview nsattributedstring uilabel xcode6 ios8

14
推荐指数
2
解决办法
5205
查看次数

与Android中的View.bringToFront()相反

我想知道是否有一些相反的方法View.bringToFront()?当我调用bringToFront()我的整个屏幕被锁定因为我有一些问题覆盖onMeasure()方法(当我实现时onMeasure,我的自定义视图不会绘制自己,即使它进入onDraw方法)和我的自定义视图占用整个屏幕....

我非常需要,bringToFront()但我需要启动一些持续3秒的动画,并且通过调用bringToFront()用户输入不再起作用.

我可以重置bringToFront()吗?

请事先提供帮助

user-interface android

13
推荐指数
2
解决办法
5820
查看次数

UIGestureRecognizer拖动UIView

我正在尝试建立一个从右到左GestureRecognizer拖动UIView.如果用户将视图拖动到屏幕的一半,则视图将自动拖动到左上角以丢弃它,但如果用户不拖动到屏幕的一半,它将返回到屏幕右侧的角落.这里很少丢失,任何教程或什么?谢谢

编辑:下面是一些代码,它是一个UIImageView,在一个内部UIScrollView,我需要拖动整个滚动或只是其中的图像:

_myScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.window.bounds.size.width, self.window.bounds.size.height)]; [_myScroll setContentSize:CGSizeMake(self.window.bounds.size.width , 1300)];

_tutorial = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.window.bounds.size.width, 1300)]; [_tutorial setImage:[UIImage imageNamed:@"Default"]];
_tutorial.contentMode = UIViewContentModeScaleAspectFit; [_myScroll addSubview:_tutorial];

_tutorial.userInteractionEnabled = YES;
    UIPanGestureRecognizer * recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:_tutorial action:@selector(handlePan:)]; 
 [_tutorial addGestureRecognizer:recognizer];

    [self.window addSubview:_myScroll];
Run Code Online (Sandbox Code Playgroud)

而我尝试拖动的方法 UIImageView

- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {

    CGPoint translation = [recognizer translationInView:_myScroll];
    recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
                                         recognizer.view.center.y + translation.y);
    [recognizer setTranslation:CGPointMake(0, 0) inView:_myScroll];

}
Run Code Online (Sandbox Code Playgroud)

uiview uigesturerecognizer ios

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