我正在尝试在WCF应用程序的服务器端抛出FaultException.我正在使用DTO作为此异常的有效负载.从某些时刻开始(对于大型对象),我开始在客户端收到"缓冲XML内容所需的大小超过缓冲区配额"异常.所有绑定消息大小参数和maxDepth设置为大的enouth值以摆脱怀疑.有人遇到过这个问题吗?似乎在互联网上还没有解决方案.设置
<dataContractSerializer maxItemsInObjectGraph="2147483647" ignoreExtensionDataObject="true" />
Run Code Online (Sandbox Code Playgroud)
没有帮助.
我有一个从TableLayout派生的视图视图,我需要声明String属性Title,如下所示:
<com.mycompany.controls.NavigationControllerView
xmlns:app="http://schemas.usetech.com/apk/res/onroad"
title="@string/nav_title"
...
/>
Run Code Online (Sandbox Code Playgroud)
(以便能够通过资源引用指定值)。我已经在values / attrs.xml中指定了此属性:
<declare-styleable name="NavigationControllerView">
<attr name="title" format="string"/>
...
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)
在我的代码中,我正在尝试:
public class NavigationControllerView extends TableLayout {
public NavigationControllerView(Context context, AttributeSet attrs) {
super(context, attrs);
View.inflate(getContext(), R.layout.inc_header, this);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NavigationControllerView);
CharSequence title = a.getString(R.styleable.NavigationControllerView_title);
if (title != null)
setTitle(title.toString());
}
...
Run Code Online (Sandbox Code Playgroud)
但没有运气,标题始终为空。看到我错了吗?
我正在尝试创建内存映像,在其上绘制并保存到磁盘.
目前的代码是:
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:256
pixelsHigh:256
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:YES
colorSpaceName:NSDeviceRGBColorSpace
bitmapFormat:NSAlphaFirstBitmapFormat
bytesPerRow:0
bitsPerPixel:8
];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:rep]];
// Draw your content...
NSRect aRect=NSMakeRect(10.0,10.0,30.0,30.0);
NSBezierPath *thePath=[NSBezierPath bezierPathWithRect:aRect];
[[NSColor redColor] set];
[thePath fill];
[NSGraphicsContext restoreGraphicsState];
NSData *data = [rep representationUsingType: NSPNGFileType properties: nil];
[data writeToFile: @"test.png" atomically: NO];
Run Code Online (Sandbox Code Playgroud)
当试图在当前上下文中绘制时,我收到错误
CGContextSetFillColorWithColor: invalid context 0x0
Run Code Online (Sandbox Code Playgroud)
这有什么不对?为什么NSBitmapImageRep返回的上下文是NULL?创建绘制图像并保存它的最佳方法是什么?
更新:
最后来到以下解决方案:
NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(256, 256)];
[image lockFocus];
NSRect aRect=NSMakeRect(10.0,10.0,30.0,30.0);
NSBezierPath *thePath=[NSBezierPath bezierPathWithRect:aRect];
[[NSColor redColor] set];
[thePath fill]; …Run Code Online (Sandbox Code Playgroud)