小编Sun*_*kas的帖子

为什么OpenGL混合不适用于HTC Desire?

有谁知道如何在HTC Desire上启用OpenGL(android)混合.我试图绘制彩色三角形并使用颜色缓冲区的alpha值将它们与背景(或另一个三角形)混合.

它适用于模拟器(2.1)和htc英雄2.1,但不是我对2.2的愿望.英雄和欲望之间是否存在一些硬件差异?

代码中的主要内容是(不按顺序):

gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

gl.glEnable(GL10.GL_BLEND);         
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

private final static float[] colors = {
       1f, 0f, 0f, 0.5f, // point 0 red
       1f, 0f, 0f, 0.5f, // point 1 red
       1f, 0f, 0f, 0.5f, // point 2 red
       1f, 0f, 0f, 0.5f, // point 3 red

       1f, 0f, 0f, 0.5f, // point 4 red
       1f, 0f, 0f, 0.5f, // point 5 red
       1f, 0f, 0f, 0.5f, // point 6 red
       1f, 0f, 0f, 0.5f, // point 7 …
Run Code Online (Sandbox Code Playgroud)

android alphablending opengl-es glblendfunc

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

OSX 10.8中的AVKit

我们正在开发一个OSX应用程序,必须得到OSX 10.7到10.9的支持.我们目前正在使用QTKit和QTMovieView来显示视频,但在最近尝试上传新版本时,我们收到以下错误消息:

Deprecated API usage. Apple no longer accepts submissions of apps that use QuickTime APIs.
Run Code Online (Sandbox Code Playgroud)

我们还测试了将Base SDK设置为10.8,但结果相同.

更改为AVKit和AVPlayerView不适用于10.9之前的版本.

那么有没有办法将AVKit用于10.9之前的版本或某种方式用QTKit发布应用程序?

macos qtkit mac-app-store

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

气馁配置:为宽度指定的自动调整以外的值(系统项,固定空格以外的值,应使用自动调整大小)

在iOS 8的XCode 6构建中,我收到以下警告:

MainStoryboard.storyboard: notice: Discouraged Configuration: Value other than autosizing specified for width (System items, other than fixed spaces, should use autosizing)
Run Code Online (Sandbox Code Playgroud)

在StachOverflow之前似乎有这样的问题,但它被删除了.在Google上找不到任何其他信息.

单击警告会将我引导至宽度为70且为0的UIBarButtonItem作为图像插入.将宽度设置为0无济于事.

有任何想法吗?

objective-c uibarbuttonitem ios

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

设置UIPageControl的CurrentPageIndicatorTintColor时出现NSRangeException

我试图UIPageControl从代码中更改对象的颜色属性.然而它崩溃了.从Interface Builder设置属性可以正常工作.

代码:

float x = isLight ? 0.8f : 0.2f;
UIColor markedColor = UIColor.FromRGB (x, x, x);
pageControll.CurrentPageIndicatorTintColor = markedColor;
pageControll.PageIndicatorTintColor = isLight ? UIColor.White : UIColor.Black;
Run Code Online (Sandbox Code Playgroud)

我得到的错误(在第三行):

Objective-C exception thrown. Name: NSRangeException Reason: *** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds for empty array

有任何想法吗?

cocoa-touch xamarin.ios

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

用于网络活动的iOS事件/通知上/下/下

当网络活动从无到有(以及相反的方式)时,我想要为我的iOS应用程序进行事件/回调.类似于Android对onDataActivity()的处理方式.我不是在谈论可达性,而是在数据实际开始或停止传输时.

该应用程序不适用于App Store,也不适用于越狱.我有一个类似的功能,通过使用检测屏幕何时开启/关闭工作

CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center
      NULL, // observer
      displayStatusChanged, // callback
      CFSTR("com.apple.iokit.hid.displayStatus"), // event name
      NULL, // object
      CFNotificationSuspensionBehaviorDeliverImmediately);
Run Code Online (Sandbox Code Playgroud)

以及其他事件

com.apple.springboard.hasBlankedScreen
com.apple.springboard.lockstate
Run Code Online (Sandbox Code Playgroud)

现在我想知道是否存在数据启动或停止传输的事件?或者,如果有人可以指出我可以通过上述方式监控的所有事件的完整列表的方向.

notifications objective-c iphone-privateapi ios springboard

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

在 UITableViewCell 中加载 UIView 的 Nib 文件不会拉伸

我有一个可通过 nib/xib 文件重用的 UIView。我想加载它并填充一个 UITableViewCell,它将在一个自动调整大小的 UITableView 中使用。全部带有自动布局。

大多数效果很好,但似乎加载的 UIView 使用周围添加的约束来缩小 UITableViewCell 的 contentView。这对高度有好处,但我不想要这个宽度。

UITableViewCell 的外观 忽略下面的灰色单元格,这只是一个选定的单元格。

public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
    let cellId = "RowView0002"
    var cell = tableView.dequeueReusableCell(withIdentifier: cellId)
    if cell == nil {
        cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: cellId)

        let subView = RowView(frame: cell!.frame)

        cell!.contentView.attachViewWithConstraints(subView)
        let _ = subView.viewLoadedFromNibAttached(name: cellId)

    }

    return cell!
}

override public func viewDidLoad() {
    super.viewDidLoad()

    tableView.delegate = self
    tableView.dataSource = self
    tableView.estimatedRowHeight = 40.0
    tableView.rowHeight = UITableViewAutomaticDimension
}

extension …
Run Code Online (Sandbox Code Playgroud)

uitableview ios autolayout uitableviewautomaticdimension

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

iOS 8中的自定义字体未显示

在为iOS 7构建时,我的自定义字体正确显示在UILabel中.但是,使用XCode 6和iOS 8构建另一个"标准"字体.

码:

UILabel *label = [[UILabel alloc] initWithFrame:rect];
UIFont *font = [[CAPTheme sharedTheme] appTitleFont];

label.text = title;
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.backgroundColor = [UIColor clearColor];
label.alpha = kLabelAlphaConstant;
[label setFont:font];
Run Code Online (Sandbox Code Playgroud)

...

- (UIFont *)appTitleFont
{
    NSArray *familyNames = [UIFont familyNames];
    for (NSString *aFamilyName in familyNames) {
        NSArray *fontNames = [UIFont fontNamesForFamilyName:aFamilyName];
        NSLog(@"familyname: %@", aFamilyName);
        for (NSString *aFontName in fontNames) {
            NSLog(@" %@", aFontName);
        }
    }
    return [UIFont fontWithFamily:@"MyFont" size:15.0f];
}
Run Code Online (Sandbox Code Playgroud)

...

+ (UIFont*)fontWithFamily:(NSString*)fontFamily size:(float)size …
Run Code Online (Sandbox Code Playgroud)

fonts objective-c ios ios8

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

Material Design:扩展工具栏+后退按钮

我想要一个普通的后退按钮和一个自定义工具栏。这是可能的还是我必须自己设置后退按钮(也是自定义的?)?

样式.xml:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="colorControlNormal">#4F8092</item>
    <item name="colorControlActivated">#4F8092</item>
    <item name="colorControlHighlight">#4F8092</item>
    <item name="colorPrimary">#fff</item>
    <item name="colorPrimaryDark">#4F8092</item>
    <item name="colorAccent">#4F8092</item>

    <item name="android:windowActionModeOverlay">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我的活动.java:

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_actionlist);

    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_actionlist_toolbar);
    setSupportActionBar(toolbar);
    ...
Run Code Online (Sandbox Code Playgroud)

我还在onCreatesetSupportActionBar 之后添加了这些:

toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Run Code Online (Sandbox Code Playgroud)

没有成功。所发生的只是我的自定义视图向右偏移,就像有一个按钮将其余内容推到右侧一样。但该按钮不可见。

活动 XML:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <android.support.v7.widget.Toolbar
        android:id="@+id/activity_action_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/rym_blue"
        app:contentInsetEnd="0dp"
        app:contentInsetStart="0dp"
        android:elevation="4dp">
...
Run Code Online (Sandbox Code Playgroud)

android material-design

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

在构建时将文件复制到Xcode项目的根目录

我正在尝试在我的iOS应用中实施Google Analytics(GA).我有两个不同的目标,它们具有不同的GA跟踪ID.GA要求GoogleService-Info.plist(无法重命名)文件放在app文件夹结构的根目录中.此文件包含tracking-id.但是,由于我有两个不同的目标,我需要有两个不同的跟踪ID.

我不能将两个文件命名为具有不同目标的相同名称的文件.

那么,有没有办法在构建过程中将另一个文件复制到根目录中.试过这个和类似但似乎不起作用:

在此输入图像描述

有什么建议?

xcode google-analytics ios

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

在另一个UIViewController中显示缩放的UIViewController

我想ViewController在另一个中显示另一个的缩小"预览" ViewController.这可能吗?不需要任何交互,因此它基本上可以是截图,但缩小.我可以通过手动截取屏幕截图并将其保存为图像来解决,但它ViewController包含大量本地化并且不断更新,因此如果可以以编程方式完成.

https://www.dropbox.com/s/kd5vinrym1k7afk/Screenshot%202014-05-13%2015.20.17.png

这可能吗?

编辑:子视图存储在故事板中

编辑:这就是我解决它的方式:

//Load the viewcontroller and view
previewViewController = [self.storyboard instantiateViewControllerWithIdentifier:[PLACEHOLDER_VIEWCONTROLLER_NAMES objectAtIndex:self.identifier]];
[self addChildViewController:previewViewController];
[self.placeholderView.superview addSubview:previewViewController.view];
previewViewController.view.transform = CGAffineTransformMakeScale(scale*2, scale*2);
CGPoint center = self.placeholderView.center;
center.y += 25;
previewViewController.view.center = center;
Run Code Online (Sandbox Code Playgroud)

objective-c uiviewcontroller ios

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