• repeat_colors = fix(row_of_points/size(colors, 1))+1; colors = repmat(colors, repeat_colors, 1); %%% Data Points %%% % Iterate through all the rows for ii = 1:row_of_points % Convert polar to ...
今天浏览了Matlab官网，看了一下官网提供的Matlab的绘图工具箱，因为很多之前没有注意到，部分虽然自己可以实现，但是功能不够完善，因此，今天做一下工具箱的总结，以用来记录自己的学习过程，详情请移步MathWorks绘图专区入口。
目录
1. 雷达图
2. 多维数据可视化之气泡图
2.1 加载数据
2.2 3D气泡图
2.3 可点击图例
2.4 七维数据的3D可视化效果图
2.5 五维数据的2D可视化效果图

1. 雷达图
雷达图，又称为蜘蛛图，MathWorks中有位大佬提供了具体的画法，这里给出其实例：
%% Example Script %%%
% Clear workspace
close all;
clearvars;
clc;

% Point properties
num_of_points = 6;
row_of_points = 4;

% Random data
P = rand(row_of_points, num_of_points);

% Scale points by a factor
P(:, 2) = P(:, 2) * 2;
P(:, 3) = P(:, 3) * 3;
P(:, 4) = P(:, 4) * 4;
P(:, 5) = P(:, 5) * 5;

% Make random values negative
P(1:3, 3) = P(1:3, 3) * -1;
P(:, 5) = P(:, 5) * -1;

% Create generic labels
P_labels = cell(num_of_points, 1);

for ii = 1:num_of_points
P_labels{ii} = sprintf('Label %i', ii);
end

% Figure properties
figure('units', 'normalized', 'outerposition', [0 0.05 1 0.95]);

% Axes properties
axes_interval = 2;
axes_precision = 1;

% Spider plot
spider_plot(P, P_labels, axes_interval, axes_precision,...
'Marker', 'o',...
'LineStyle', '-',...
'LineWidth', 2,...
'MarkerSize', 5);

% Title properties
title('Sample Spider Plot',...
'Fontweight', 'bold',...
'FontSize', 12);

% Legend properties
legend('show', 'Location', 'southoutside');

笔者喜欢一步到位，下面是雷达图实现的源码，后期可能更新有所不同，不过只要知道大概意思就行，大家可以在次基础上改：
function spider_plot(P, P_labels, axes_interval, axes_precision, varargin)
% Create a spider web or radar plot with an axes specified for each column
%
% spider_plot(P, P_labels, axes_interval, axes_precision) creates a spider
% web plot using the points specified in the array P. The column of P
% contains the data points and the rows of P contain the multiple sets of
% data points. Each point must be accompanied by a label specified in the
% cell P_labels. The number of intervals that separate the axes is
% specified by axes_interval. The number of decimal precision points is
% specified by axes_precision.
%
% P - [vector | matrix]
% P_labels - [cell of string]
% axes_interval - [integer]
% axes_precision - [integer]
%
% spider_plot(P, P_labels, axes_interval, axes_precision, line_spec) works
% the same as the function above. Additional line properties can be added
% in the same format as the default "plot" function in MATLAB.
%
% line_spec - [character vector]
%
% %%%%%%%%%%%%%%%%%%% Example of a Generic Spider Plot %%%%%%%%%%%%%%%%%%%
% % Clear workspace
% close all;
% clearvars;
% clc;
%
% % Point properties
% num_of_points = 6;
% row_of_points = 4;
%
% % Random data
% P = rand(row_of_points, num_of_points);
%
% % Scale points by a factor
% P(:, 2) = P(:, 2) * 2;
% P(:, 3) = P(:, 3) * 3;
% P(:, 4) = P(:, 4) * 4;
% P(:, 5) = P(:, 5) * 5;
%
% % Make random values negative
% P(1:3, 3) = P(1:3, 3) * -1;
% P(:, 5) = P(:, 5) * -1;
%
% % Create generic labels
% P_labels = cell(num_of_points, 1);
%
% for ii = 1:num_of_points
%     P_labels{ii} = sprintf('Label %i', ii);
% end
%
% % Figure properties
% figure('units', 'normalized', 'outerposition', [0 0.05 1 0.95]);
%
% % Axes properties
% axes_interval = 2;
% axes_precision = 1;
%
% % Spider plot
% spider_plot(P, P_labels, axes_interval, axes_precision,...
%     'Marker', 'o',...
%     'LineStyle', '-',...
%     'LineWidth', 2,...
%     'MarkerSize', 5);
%
% % Title properties
% title('Sample Spider Plot',...
%     'Fontweight', 'bold',...
%     'FontSize', 12);
%
% % Legend properties
% legend('show', 'Location', 'southoutside');
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Point Properties %%%
% Number of points
[row_of_points, num_of_points] = size(P);

%%% Error Check %%%
% Check if axes properties are an integer
if floor(axes_interval) ~= axes_interval || floor(axes_precision) ~= axes_precision
error('Error: Please enter in an integer for the axes properties.');
end

% Check if axes properties are positive
if axes_interval < 1 || axes_precision < 1
error('Error: Please enter value greater than one for the axes properties.');
end

% Check if the labels are the same number as the number of points
if length(P_labels) ~= num_of_points
error('Error: Please make sure the number of labels is the same as the number of points.');
end

% Pre-allocation
max_values = zeros(1, num_of_points);
min_values = zeros(1, num_of_points);
axis_increment = zeros(1, num_of_points);

% Normalized axis increment
normalized_axis_increment = 1/axes_interval;

% Iterate through number of points
for ii = 1:num_of_points
% Group of points
group_points = P(:, ii);

% Max and min value of each group
max_values(ii) = max(group_points);
min_values(ii) = min(group_points);
range = max_values(ii) - min_values(ii);

% Axis increment
axis_increment(ii) = range/axes_interval;

% Normalize points to range from [0, 1]
P(:, ii) = (P(:, ii)-min(group_points))/range;

% Shift points by one axis increment
P(:, ii) = P(:, ii) + normalized_axis_increment;
end

%%% Polar Axes %%%
% Polar increments
polar_increments = 2*pi/num_of_points;

% Normalized  max limit of axes
axes_limit = 1;

% Shift axes limit by one axis increment
axes_limit = axes_limit + normalized_axis_increment;

% Polar points
theta = 0:polar_increments:2*pi;

% Convert polar to cartesian coordinates

% Plot polar axes
grey = [1, 1, 1] * 0.5;
h = line(x_axes, y_axes,...
'LineWidth', 1,...
'Color', grey);

% Iterate through all the line handles
for ii = 1:length(h)
% Remove polar axes from legend
h(ii).Annotation.LegendInformation.IconDisplayStyle = 'off';
end

%%% Polar Isocurves %%%
% Shifted axes interval
shifted_axes_interval = axes_interval+1;

% Convert polar to cartesian coordinates

% Plot polar isocurves
hold on;
h = plot(x_isocurves', y_isocurves',...
'LineWidth', 1,...
'Color', grey);

% Iterate through all the plot handles
for ii = 1:length(h)
% Remove polar isocurves from legend
h(ii).Annotation.LegendInformation.IconDisplayStyle = 'off';
end

%%% Figure Properties %%%
colors = [0, 0.4470, 0.7410;...
0.8500, 0.3250, 0.0980;...
0.9290, 0.6940, 0.1250;...
0.4940, 0.1840, 0.5560;...
0.4660, 0.6740, 0.1880;...
0.3010, 0.7450, 0.9330;...
0.6350, 0.0780, 0.1840];

% Repeat colors is necessary
repeat_colors = fix(row_of_points/size(colors, 1))+1;
colors = repmat(colors, repeat_colors, 1);

%%% Data Points %%%
% Iterate through all the rows
for ii = 1:row_of_points
% Convert polar to cartesian coordinates
[x_points, y_points] = pol2cart(theta(1:end-1), P(ii, :));

% Make points circular
x_circular = [x_points, x_points(1)];
y_circular = [y_points, y_points(1)];

% Plot data points
plot(x_circular, y_circular,...
'Color', colors(ii, :),...
'MarkerFaceColor', colors(ii, :),...
varargin{:});
end

%%% Axis Properties %%%
% Figure background
fig = gcf;
fig.Color = 'white';

% Iterate through all the number of points
for hh = 1:num_of_points
% Shifted min value
shifted_min_value = min_values(hh)-axis_increment(hh);

% Axis label for each row
row_axis_labels = (shifted_min_value:axis_increment(hh):max_values(hh))';

% Iterate through all the isocurve radius
% Display axis text for each isocurve
text(x_isocurves(ii, hh), y_isocurves(ii, hh), sprintf(sprintf('%%.%if', axes_precision), row_axis_labels(ii)),...
'Units', 'Data',...
'Color', 'k',...
'FontSize', 10,...
'HorizontalAlignment', 'center',...
'VerticalAlignment', 'middle');
end
end

% Label points
x_label = x_isocurves(end, :);
y_label = y_isocurves(end, :);

% Shift axis label
shift_pos = 0.07;

% Iterate through each label
for ii = 1:num_of_points
% Angle of point in radians
theta_point = theta(ii);

% Find out which quadrant the point is in
if theta_point == 0
elseif theta_point == pi/2
elseif theta_point == pi
elseif theta_point == 3*pi/2
elseif theta_point == 2*pi
elseif theta_point > 0 && theta_point < pi/2
elseif theta_point > pi/2 && theta_point < pi
elseif theta_point > pi && theta_point < 3*pi/2
elseif theta_point > 3*pi/2 && theta_point < 2*pi
end

case 0
horz_align = 'left';
vert_align = 'middle';
x_pos = shift_pos;
y_pos = 0;
case 1
horz_align = 'left';
vert_align = 'bottom';
x_pos = shift_pos;
y_pos = shift_pos;
case 1.5
horz_align = 'center';
vert_align = 'bottom';
x_pos = 0;
y_pos = shift_pos;
case 2
horz_align = 'right';
vert_align = 'bottom';
x_pos = -shift_pos;
y_pos = shift_pos;
case 2.5
horz_align = 'right';
vert_align = 'middle';
x_pos = -shift_pos;
y_pos = 0;
case 3
horz_align = 'right';
vert_align = 'top';
x_pos = -shift_pos;
y_pos = -shift_pos;
case 3.5
horz_align = 'center';
vert_align = 'top';
x_pos = 0;
y_pos = -shift_pos;
case 4
horz_align = 'left';
vert_align = 'top';
x_pos = shift_pos;
y_pos = -shift_pos;
end

% Display text label
text(x_label(ii)+x_pos, y_label(ii)+y_pos, P_labels{ii},...
'Units', 'Data',...
'HorizontalAlignment', horz_align,...
'VerticalAlignment', vert_align,...
'EdgeColor', 'k',...
'BackgroundColor', 'w');
end

% Axis limits
axis square;
axis([-axes_limit, axes_limit, -axes_limit, axes_limit]);
axis off;
end
2. 多维数据可视化之气泡图
真的是很棒，之前虽然笔者也曾写过五维的数据可视化气泡图，相比大佬，自叹望尘莫及：Bubbleplot visualization of multi-dimensional data。该工具箱可以创建2维和三维散点图，最多可以利用颜色、形状、大小以及标注文本可视化七个维度的数据信息。绘制气泡图的工具箱源码如下：
function [lh, th] = bubbleplot(x, y, z, siz, col, shape, varargin)
% BUBBLEPLOT produces a scatter plot that enables the visualization of upto
% 6-dimensional data. The dimensions used for displaying data include the
% X, Y and Z coordinates, the marker size, color and shape.
%
% USAGE:
% BUBBLEPLOT(x, y, z, siz, col, shape)
%    draws a 3D bubble plot. See input parameter description below.
%
% BUBBLEPLOT(x, y, [], siz, col, shape)
%    draws a 2D bubble plot.
%
% BUBBLEPLOT(..., textarray)
%    enables you to pass in a cell array of strings to annotate each point
%    on the plot. By default the strings are displayed as text labels as well
%    as stored in the UserData property of the line objects
%
% BUBBLEPLOT(..., textarray, 'ShowText', false)
%    will not display the text on screen, but will store it in the user
%    data property. This can be useful when creating a custom data tip.
%
% [hLine, hText] = BUBBLEPLOT(...)
%    returns a vector of line handles to the points in the plot and
%    (if appropriate) a vector of handles to the text objects on the
%    screen.
%
% INPUT PARAMETERS:
% The inputs should be vectors of the same length, with the following
% requirements:
%  Input     Required     Default-Value         Type
% x, y, z      Yes             N/A          Numerical (Continuous or discrete)
%   siz         No              8           Numerical (Continuous or discrete)
%   col         No           col = z        Numerical or Categorical*
%  shape        No             'o'          Categorical* (upto 13 unique discrete values)
%
% NOTES:
% * "Categorical" variables can either be numeric with discrete values or
%   non-numeric data types that support a "UNIQUE" method. Examples of this
%   can be a cell array of strings, a nominal array or ordinal array.
%
% * The siz variable is normalized to a marker size range of 3 to 20. To
%   specify a custom size range use the optional parameter
%   'markerSizeLimits'. Example: BUBBLEPLOT(..., 'MarkerSizeLimits', [5 32])
%
% * The shape variable can also be a character that represents a marker
%   shape to be used for all points
%
% * If col is a categorical variable, ensure it is integer-valued so that
%   it is handled correctly. If it is not integer valued, BUBBLEPLOT will
%   check to see if the number of unique values is less than 10% of the
%   length of the vector and use that to determine if the variable is
%   categorical. The colors used to depict categorical data are evenly
%   spaced (1 color level per unique category/label). However if col is
%   not categorical, its values are simply scaled to different values in
%   the colormap
%
% * The default font size used to display the text labels is 8 pt with a
%   left alignment. Use the input arguments 'FontSize' and 'Alignment' to
%   control these properties.
%   Example: BUBBLEPLOT(..., 'FontSize', 6, 'Alignment', 'center')
%
% * You can specify a custom colormap using the Colormap argument. The
%   parameter can be a string (eg. 'cool'), a function handle (eg. @jet) or
%   an N-by-3 matrix of color RGB levels.
%   Example: BUBBLEPLOT(..., 'ColorMap', cmap)

% Copyright 2009-2014 The MathWorks, Inc.

%% Parse input params and defaults

% Check number of input arguments
error(nargchk(2,10,nargin,'struct'));

% Default z
if nargin < 3
z = [];
end

% Default size
if nargin < 4 || isempty(siz)
siz = 8;
end

if nargin < 5 || isempty(col)
col = z;
end

if nargin < 6 || isempty(shape)
shape = 'o';
end

p = inputParser;
p.parse(varargin{:});
desctext = p.Results.Text;
showText = p.Results.ShowText;
if isempty(desctext), showText = false; end
fontSize = p.Results.FontSize;
alignment = p.Results.Alignment;
colmapfun = p.Results.ColorMap;
markerSizeLimits = p.Results.MarkerSizeLimits;

%% Determine marker colors
if ischar(colmapfun)
colmapfun = str2func(colmapfun);
elseif isnumeric(colmapfun)
colmapfun = @(x)colmapfun(1:min(x,end),:);
end

if isempty(col)
col = zeros(size(x));
end
[uniqueCols, gar, colInd] = unique(col);
if isinteger(col) || isa(col,'categorical') || iscell(col) || length(uniqueCols)<=.1*length(col) || all(round(col)==col) % Is col categorical
% Generate a colormap with one level per unique entry in col
colmap = colmapfun(length(uniqueCols));
else
% Scale the color values to span the colormap
colmap = colmapfun(256);
mx = max(col);
n = min(col);
if mx == n, mx = n + 1; end
colInd = (col-n)/(mx-n)*(size(colmap,1)-1)+1;
end
try
color = colmap(round(colInd),:);
catch %#ok<CTCH>
error('The custom colormap must have at least %d levels', max(colInd));
end

%% Determine marker shape
if ischar(shape)
markertype = repmat(shape(1),size(x));
else
markerseq = 'osd^><vph.*+x';
[uniqueShapes, gar, shapeInd] = unique(shape);
if length(uniqueShapes)>length(markerseq)
error('BubblePlot can only support 13 unique shapes');
end
markertype = markerseq(shapeInd);
end

%% Determine marker size
if isscalar(siz)
siz = repmat(siz, size(x));
markersize = siz;
else % Map the siz variable to a markersize between a minimum and maximum
minsize = markerSizeLimits(1);
maxsize = markerSizeLimits(2);
markersize = (siz - min(siz))/(max(siz)-min(siz))*(maxsize - minsize)+minsize;
end

%% Clean up data - handle NaNs
markersize(isnan(markersize)) = .01; % These will not be drawn as regular markers, just pixel points

%isnan(x) | isnan(y) | isnan(z) | isnan(col) |

%% Plot data
% Create structure to store original data in every graphics object (for
% subsequent retrieval, eg: with data tip)

pointData = struct('x',num2cell(x),'y',num2cell(y),'siz',num2cell(siz),'col',num2cell(col),...
'shape',num2cell(shape));

if nargin > 6 && ~isempty(desctext)
if ~iscellstr(desctext)
desctext = cellstr(desctext);
end
[pointData.text] = desctext{:};
end

if isempty(z)
plotfun = @plot;
%plotfun = @patch;
%zarg = {color(1,:)};
zarg = {};
else
plotfun = @plot3;
zarg = {z(1)};
zdata = num2cell(z);
[pointData.z] = zdata{:};
end

lh = zeros(1,length(x)); % Line Handles
lh(1) = customPlot(plotfun, pointData(1), color(1,:), markersize(1), markertype(1), x(1), y(1), zarg{:});

for i = 2:length(lh)
if isempty(z), zarg = {}; else zarg = {z(i)}; end
%if isempty(z), zarg = {color(i,:)}; else zarg = {z(i)}; end
lh(i) = customPlot(@line, pointData(i), color(i,:), markersize(i), markertype(i), x(i), y(i), zarg{:});
%lh(i) = customPlot(@patch, pointData(i), color(i,:), markersize(i), markertype(i), x(i), y(i), zarg{:});
end

if showText
hAxes = get(lh(1),'Parent');
offset = diff(get(hAxes,'Ylim'))*.01;
if isempty(z)
z = zeros(size(x));
end
th = text(x, y-offset, z, desctext, 'Fontsize', fontSize, 'HorizontalAlignment', alignment);
lims = get(hAxes,{'XLim','YLim','ZLim'});
lims = vertcat(lims{:});
factor = fontSize.*diff(lims,[],2);
else
th = [];
end

function lh = customPlot(funh, pointData, c, siz, markertype, varargin)
lh = funh(varargin{:});
set(lh, 'Marker', markertype,...
'LineStyle', 'none', 'Color', c, ...
'MarkerFaceColor', c, ...
'MarkerEdgeColor', [0 0 0], 'MarkerSize', siz,...
'UserData', struct('Point',pointData));

%     lh = patch('XData',x(i),'YData', y(i), 'ZData', z(i), 'Marker', 'o',...
%     'LineStyle', 'none', 'CData', color, 'MarkerFaceColor', c, ...
%     'MarkerEdgeColor', [0 0 0], 'MarkerSize', siz2(i), 'FaceAlpha', .4, 'EdgeAlpha', .2, ...
%     'UserData', data);

function resizeText(hAxes, hText, y, factor) %#ok<*INUSD>
lims = get(hAxes,{'XLim','YLim','ZLim'});
lims = vertcat(lims{:});
% Uncomment following to update fontsize
% newfs = min([factor(1:2)./diff(lims(1:2,:),[],2) ; 24]);
% set(hText,'FontSize',newfs);

% Update position
offset = diff(get(hAxes,'Ylim'))*.01;
p = get(hText,'Position');
p = vertcat(p{:});
outofbounds = any(bsxfun(@gt,p,lims(:,2)') | bsxfun(@lt,p,lims(:,1)'), 2);
set(hText(outofbounds),'Visible','off');
set(hText(~outofbounds),'Visible','on');

p(:,2) = y - offset;
for i = 1:length(p)
set(hText(i),'Position',p(i,:));
end
2.1 加载数据
加载随机样本数据：
load carsmall
Origin = cellstr(Origin);
2.2 3D气泡图
X: Acceleration (continuous)Y: Horsepower (continuous)Z: MPG (continuous)Size: Weight (continuous)Color: Model_Year (discrete, ordinal)Shape: Origin
clf
bubbleplot(Acceleration, Horsepower, MPG, Weight, Model_Year, Origin);
grid on
xlabel('Acceleration');ylabel('Horsepower');zlabel('MPG');

2.3 可点击图例
可点击图例可以让你能够隐藏或者强调某一组数据，需要用到 clickableLegend 工具箱的源码如下：
function varargout = clickableLegend(varargin)
% clickableLegend  Interactive legend for toggling or highlighting graphics
%
% clickableLegend is a wrapper around the LEGEND function that provides
% interactive display toggling or highlighting of lines or patches in a MATLAB
% plot. It enables you to,
% * Toggle (hide/show) a graphics object (or group) by clicking on an
%   associated text label in the legend
% * Highlight and identify a graphics object (or group) by clicking it.
%
% Its usage is the same as the <a href="matlab: help legend">LEGEND</a> function with additional
% optional parameters. For further information please see the LEGEND documentation.
%
% ADDITIONAL ARGUMENTS specific to clickableLegend:
% These are passed in as parameter-value pairs
%
% * groups: A vector specifying the group membership for every line object.
%   The grouping parameter lets you have a group of lines represented and
%   controlled by one entry in the legend. This can be useful if you would
%   like to highlight or hide a group of lines by clicking on one legend entry.
%   CONSIDERATIONS:
%   # The number of unique entries in the group vector must match the
%     number of strings in the legend
%   # When passing a vector of line/patch handles as the first input
%     argument, the vector should contain all lines/patches whose group
%     membership is included in the group vector. ie. the length of the
%     vector of handles must match that of the length of the group vector.
%
% * displayedLines: A vector of indices corresponding to the lines or groups that
%   should be displayed initially. This option is useful if there are too
%   many lines in the figure and you are only interested in looking at a
%   few at first.
%   Example: clickableLegend(..., 'displayedLines', [4 5 6])
%
% * plotOptions: A cell array of parameter value pairs that define
%   properties of the graphics objects in the legend. This can be useful,
%   for example, to ensure consistent marker sizes within the legend.
%
% Notes:
% 1. If you save the figure and re-load it, the toggling functionality
% is not automatically re-enabled. To restore it, simply call clickableLegend
% with no arguments.
%
% 2. To prevent the axis from automatically scaling every time a line is
% turned on and off, issue the command: axis manual
%
% Example 1:
% z = peaks(100);
% plot(z(:,26:5:50))
% grid on;
% axis manual;
% clickableLegend({'Line1','Line2','Line3','Line4','Line5'}, 'Location', 'NorthWest');
%
% Example 2:
% f = plot([1:10;1:2:20]','x'); hold on;
% g = plot(sin([1:10;1:2:20]'),'r-');
% h = plot(11:20,rand(5,10)*5,'b:');
% clickableLegend([f;g;h], {'Line1','Line2','Line3'},...
%   'groups', [1 1 2 2 3 3 3 3 3], 'displayedLines', [2 3]);
%
% hgsave(gcf, 'testfig.fig');
% clickableLegend
%

% Extract any arguments for clickableLegend
[dispinds, groupmem, plotOptions, varargin] = ...
extractOptionalArgs(varargin{:});

% Process group memberships
[groups, plotObj, varargin] = processGroups(groupmem, varargin{:});

% Create legend
[varargout{1:nargout(@legend)}] = legend(varargin{:});

% Extract what is needed for the rest of the function and fix varargout
[leghan, objhan, plothan] = varargout{1:3};
% objhan: strings
% plothan: graphics objects
varargout = varargout(1:nargout);

if isempty(groupmem) % Default group membership
groupmem = 1:length(plothan);
plotObj = plothan;
groups = groupmem;
end

if ~isempty(dispinds) % DisplayedLines parameter was specified
hidden = true(1, length(plothan));
dispinds(dispinds>length(plothan)) = [];
hidden(dispinds) = false;
end

% Set the callbacks & plot options
for i = 1:length(plothan)
set(objhan(i), 'HitTest', 'on', 'ButtonDownFcn',...
@(varargin)togglevisibility(objhan(i),plotObj(groupmem==groups(i))),...
'UserData', true);
if ~isempty(dispinds) && hidden(i)
togglevisibility(objhan(i), plotObj(groupmem==groups(i)));
end
set(plotObj(groupmem==groups(i)), 'HitTest', 'on', 'ButtonDownFcn', ...
@(varargin)highlightObject(objhan(i),plothan(i),...
plotObj(groupmem==groups(i)),plotOptions),...
'UserData', false);
if ~isempty(plotOptions)
set(plothan(i), plotOptions{:});
end
end

function togglevisibility(hObject, obj)
if get(hObject, 'UserData') % It is on, turn it off
set(hObject, 'UserData', false);
set(obj,'HitTest','off','Visible','off','handlevisibility','off');
else
set(hObject, 'UserData', true);
set(obj, 'HitTest','on','visible','on','handlevisibility','on');
end

function highlightObject(lTextObj, lMarkerObj, plotObj, plotOptions)
lw = get(plotObj,'LineWidth');
if ~iscell(lw), lw = {lw}; end;
ms = get(plotObj,'MarkerSize');
if ~iscell(ms), ms = {ms}; end;

if ~get(plotObj(1), 'UserData') % It is not selected, highlight it
%set(hObject, 'FontWeight', 'bold');
set(lTextObj, 'EdgeColor', 'k');
set(plotObj, {'LineWidth', 'MarkerSize'}, [cellfun(@(x)x+2, lw, 'Uniformoutput', false) cellfun(@(x)x+2, ms, 'uniformoutput', false)]);
set(plotObj, 'UserData', true);
else
%set(hObject, 'FontWeight', 'normal');
set(lTextObj, 'EdgeColor', 'none');
set(plotObj, {'LineWidth', 'MarkerSize'}, [cellfun(@(x)x-2, lw, 'Uniformoutput', false) cellfun(@(x)x-2, ms, 'uniformoutput', false)]);
set(plotObj, 'UserData', false);
end
if ~isempty(plotOptions)
set(lMarkerObj, plotOptions{:});
end

function [dispinds, groupmem, plotOpt, varargin] = extractOptionalArgs(varargin)
% Extract the displayedlines and/or groups arguments if specified

ind = find(strcmpi(varargin,'DisplayedLines'));
if ~isempty(ind)
assert(ind<nargin, 'The DisplayedLines parameter value must be specified');
dispinds = varargin{ind+1};
varargin(ind:ind+1) = [];
else
dispinds = [];
end

ind = find(strcmpi(varargin,'groups'));
if ~isempty(ind)
assert(ind < nargin, 'The groups parameter value must be specified');
groupmem = varargin{ind+1};
varargin(ind:ind+1) = [];
else
groupmem = [];
end

ind = find(strcmpi(varargin,'plotoptions'));
if ~isempty(ind)
assert(ind < nargin, 'The plotOptions parameter value must be specified');
plotOpt = varargin{ind+1};
varargin(ind:ind+1) = [];
else
plotOpt = {};
end

function [groups, obj, varargin] = processGroups(groupmem, varargin)
if isempty(groupmem)
groups = []; obj = [];
return;
end
if iscellstr(groupmem)
groupmem = categorical(groupmem);
end
groups = unique(groupmem);
firstmem = zeros(size(groups));
if nargin > 1 && ishandle(varargin{1}(1))
if strcmpi(get(varargin{1}(1),'Type'),'axes')
hAxes = varargin{1}(1);
obj = flipud([findobj(hAxes,'Type','line');findobj(hAxes,'Type','patch')]);
else % It's a line/patch
obj = varargin{1};
[~,firstmem] = ismember(groups, groupmem);
%for i = 1:length(groups)
%    firstmem(i) = find(groupmem==groups(i),1);
%end
varargin{1} = obj(firstmem);
end
else
hAxes = gca;
obj = flipud([findobj(hAxes,'Type','line');findobj(hAxes,'Type','patch')]);
end
实例代码如下：
clf
h = bubbleplot(Acceleration, Horsepower, MPG, Weight, Model_Year, Origin);
grid on
xlabel('Acceleration');ylabel('Horsepower');zlabel('MPG');

clickableLegend(h, unique(Origin), 'groups', Origin, 'plotOptions', ...
{'MarkerSize', 8, 'MarkerFaceColor', 'c'});

2.4 七维数据的3D可视化效果图
X: Acceleration (continuous)Y: Horsepower (continuous)Z: MPG (continuous)Size: Weight (continuous)Color: Model_Year (discrete, ordinal)Shape: CylindersText: Origin
clf
bubbleplot(Acceleration, Horsepower, MPG, Weight, Model_Year, Cylinders,...
Origin, 'fontSize',6);
grid on
xlabel('Acceleration');ylabel('Horsepower');zlabel('MPG');

2.5 五维数据的2D可视化效果图
X: Horsepower (continuous)Y: MPG (continuous)Size: Acceleration (continuous)Color: Displacement (continuous)Shape: OriginText: Manufacturer
clf
h = bubbleplot(Horsepower, MPG, [], Acceleration, Displacement, Origin,...
Mfg, 'fontSize', 6);
xlabel('Horsepower');ylabel('MPG');
grid on;
clickableLegend(h, unique(Origin), 'groups', Origin, 'plotOptions', ...
{'MarkerSize', 8, 'MarkerFaceColor', 'c'});

展开全文
• What is a CDN? A content delivery network (CDN) refers to a geographically distributed group of servers which work together to provide fast delivery of Internet content. A CDN allows for the quick tr...
What is a CDN?
A content delivery network (CDN) refers to a geographically distributed group of servers which work together to provide fast delivery of Internet content. A CDN allows for the quick transfer of assets needed for loading Internet content including HTML pages, javascript files, stylesheets, images, and videos. The popularity of CDN services continues to grow, and today the majority of web traffic is served through CDNs, including traffic from major sites like Facebook, Netflix, and Amazon.
A properly configured CDN may also help protect websites against some common malicious attacks, such as Distributed Denial of Service (DDOS) attacks.
Is a CDN the same as a web host?
While a CDN does not host content and can’t replace the need for proper web hosting, it does help cache content at the network edge, which improves website performance. Many websites struggle to have their performance needs met by traditional hosting services, which is why they opt for CDNs. By utilizing caching to reduce hosting bandwidth, helping to prevent interruptions in service, and improving security, CDNs are a popular choice to relieve some of the major pain points that come with traditional web hosting.
What are the benefits of using a CDN?
Although the benefits of using a CDN vary depending on the size and needs of an Internet property, the primary benefits for most users can be broken down into 4 different components:
Improving website load times - By distributing content closer to website visitors by using a nearby CDN server (among other optimizations), visitors experience faster page loading times. As visitors are more inclined to click away from a slow-loading site, a CDN can reduce bounce rates and increase the amount of time that people spend on the site. In other words, a faster a website means more visitors will stay and stick around longer.Reducing bandwidth costs - Bandwidth consumption costs for website hosting is a primary expense for websites. Through caching and other optimizations, CDNs are able to reduce the amount of data an origin server must provide, thus reducing hosting costs for website owners.Increasing content availability and redundancy - Large amounts of traffic or hardware failures can interrupt normal website function. Thanks to their distributed nature, a CDN can handle more traffic and withstand hardware failure better than many origin servers.Improving website security - A CDN may improve security by providing DDoS mitigation, improvements to security certificates, and other optimizations.
How does a CDN work?
At its core, a CDN is a network of servers linked together with the goal of delivering content as quickly, cheaply, reliably, and securely as possible. In order to improve speed and connectivity, a CDN will place servers at the exchange points between different networks. These Internet exchange points (IXPs) are the primary locations where different Internet providers connect in order to provide each other access to traffic originating on their different networks. By having a connection to these high speed and highly interconnected locations, a CDN provider is able to reduce costs and transit times in high speed data delivery.

Latency - How does a CDN improve website load times?
When it comes to websites loading content, users drop off quickly as a site slows down. CDN services can help to reduce load times in the following ways:
The globally distributed nature of a CDN means reduce distance between users and website resources. Instead of having to connect to wherever a website’s origin server may live, a CDN lets users connect to a geographically closer data center. Less travel time means faster service.Hardware and software optimizations such as efficient load balancing and solid-state hard drives can help data reach the user faster.CDNs can reduce the amount of data that’s transferred by reducing file sizes using tactics such as minification and file compression. Smaller file sizes mean quicker load times.CDNs can also speed up sites which use TLS/SSL certificates by optimizing connection reuse and enabling TLS false start.
Explore all the ways a CDN helps websites load faster
Reliability and Redundancy - How does a CDN keep a website always online?
Uptime is a critical component for anyone with an Internet property. Hardware failures and spikes in traffic, as a result of either malicious attacks or just a boost in popularity, have the potential to bring down a web server and prevent users from accessing a site or service. A well-rounded CDN has several features that will minimize downtime:
Load balancing distributes network traffic evenly across several servers, making it easier to scale rapid boosts in traffic.Intelligent failover provides uninterrupted service even if one or more of the CDN servers go offline due to hardware malfunction; the failover can redistribute the traffic to the other operational servers.In the event that an entire data center is having technical issues, Anycast routing transfers the traffic to another available data center, ensuring that no users lose access to the website.
Data Security - How does a CDN protect data?
Information security is an integral part of a CDN. a CDN can keep a site secured with fresh TLS/SSL certificates which will ensure a high standard of authentication, encryption, and integrity. Investigate the security concerns surrounding CDNs, and explore what can be done to securely deliver content. 
展开全文
• 当命令配置文件名相同时，可以通过man 1 passwd查看命令帮助，man 5 passwd查看配置文件帮助 两种帮助文件（命令配置文件相同时） 1.命令的帮助 5.配置文件的帮助 一、man查看命令帮助 在man阅读...
Linux帮助命令

man命令在内部是使用more来查看帮助文件的，所以可以使用more命令的一些快捷键  当命令和配置文件名相同时，可以通过man 1 passwd查看命令帮助，man 5 passwd查看配置文件帮助

两种帮助文件（命令和配置文件相同时）  1.命令的帮助  5.配置文件的帮助
一、man查看命令帮助
在man阅读命令信息下按/输入搜索内容可以在当前文本中查找，同时按n跳转到下一个查找到的内容
二、man查看配置文件帮助

不能以绝对路径查看，否则是打印文件内容

man 配置文件名

三、其他相关命令
3.1、whatis只查看命令简短帮助文档信息
[root@localhost ~]# whatis ifconfig
ifconfig (8)         - 配置网络接口
3.2、apropos只查看配置文件简短帮助文档信息
[root@localhost ~]# apropos ifconfig
ifconfig (8)         - 配置网络接口
ifcfg (8)            - simplistic script which replaces ifconfig IP management
pifconfig (8)        - display information about a network interface

3.3、命令后加–help查看常见的命令选项信息
[root@localhost ~]# ls --help
用法：ls [选项]... [文件]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
-a, --all         不隐藏任何以. 开始的项目
-A, --almost-all      列出除. 及.. 以外的任何项目
--author          与-l 同时使用时列出每个文件的作者
-b, --escape          以八进制溢出序列表示不可打印的字符
--block-size=SIZE      scale sizes by SIZE before printing them; e.g.,
'--block-size=M' prints sizes in units of
1,048,576 bytes; see SIZE format below
-B, --ignore-backups       do not list implied entries ending with ~
-c                         with -lt: sort by, and show, ctime (time of last
modification of file status information);
with -l: show ctime and sort by name;
otherwise: sort by ctime, newest first
-C                         list entries by columns
--color[=WHEN]         colorize the output; WHEN can be 'never', 'auto',
-d, --directory            list directories themselves, not their contents
-D, --dired                generate output designed for Emacs' dired mode
-f                         do not sort, enable -aU, disable -ls --color
-F, --classify             append indicator (one of */=>@|) to entries
--file-type            likewise, except do not append '*'
--format=WORD          across -x, commas -m, horizontal -x, long -l,
single-column -1, verbose -l, vertical -C
--full-time            like -l --time-style=full-iso
-g                类似-l，但不列出所有者
--group-directories-first
group directories before files;
can be augmented with a --sort option, but any
use of --sort=none (-U) disables grouping
-G, --no-group        以一个长列表的形式，不输出组名
(例如 1K 234M 2G)
--si          同上面类似，但是使用1000 为基底而非1024
-H, --dereference-command-line
that points to a directory
--hide=PATTERN         do not list implied entries matching shell PATTERN
(overridden by -a or -A)
--indicator-style=WORD  append indicator with style WORD to entry names:
none (default), slash (-p),
file-type (--file-type), classify (-F)
-i, --inode                print the index number of each file
-I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
-k, --kibibytes            default to 1024-byte blocks for disk usage
-l                使用较长格式列出信息
-L, --dereference     当显示符号链接的文件信息时，显示符号链接所指示
的对象而并非符号链接本身的信息
-m                所有项目以逗号分隔，并填满整行行宽
-n, --numeric-uid-gid     类似 -l，但列出UID 及GID 号
-N, --literal         输出未经处理的项目名称 (如不特别处理控制字符)
-o                类似 -l，但不列出有关组的信息
-p,  --indicator-style=slash  对目录加上表示符号"/"
-q, --hide-control-chars   print ? instead of nongraphic characters
--show-control-chars   show nongraphic characters as-is (the default,
unless program is 'ls' and output is a terminal)
-Q, --quote-name           enclose entry names in double quotes
--quoting-style=WORD   use quoting style WORD for entry names:
literal, locale, shell, shell-always, c, escape
-r, --reverse         逆序排列
-R, --recursive       递归显示子目录
-s, --size            以块数形式显示每个文件分配的尺寸
-S                         sort by file size
--sort=WORD            sort by WORD instead of name: none (-U), size (-S),
time (-t), version (-v), extension (-X)
--time=WORD            with -l, show time as WORD instead of default
modification time: atime or access or use (-u)
ctime or status (-c); also use specified time
as sort key if --sort=time
--time-style=STYLE     with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, or +FORMAT;
FORMAT is interpreted like in 'date'; if FORMAT
is FORMAT1<newline>FORMAT2, then FORMAT1 applies
to non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with 'posix-', STYLE
takes effect only outside the POSIX locale
-t                         sort by modification time, newest first
-T, --tabsize=COLS         assume tab stops at each COLS instead of 8
-u                         with -lt: sort by, and show, access time;
with -l: show access time and sort by name;
otherwise: sort by access time
-U                         do not sort; list entries in directory order
-v                         natural sort of (version) numbers within text
-w, --width=COLS           assume screen width instead of current value
-x                         list entries by lines instead of by columns
-X                         sort alphabetically by entry extension
-1                         list one file per line

SELinux options:

--lcontext                 Display security context.   Enable -l. Lines
will probably be too wide for most displays.
-Z, --context              Display security context so it fits on most
displays.  Displays only mode, user, group,
security context and file name.
--scontext                 Display only security context and file name.
--help        显示此帮助信息并退出
--version     显示版本信息并退出

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).
3.4、help+命令 查看Shell内置命令

查不到命令路径的都是Shell内置命令

[root@localhost temp]# help umask
显示或设定文件模式掩码。

设定用户文件创建掩码为 MODE 模式。如果省略了 MODE，则
打印当前掩码的值。

如果MODE 模式以数字开头，则被当作八进制数解析；否则是一个
chmod(1) 可接收的符号模式串。

选项：
-p    如果省略 MDOE 模式，以可重用为输入的格式输入
-S    以符号形式输出，否则以八进制数格式输出

退出状态：
返回成功，除非使用了无效的 MODE 模式或者选项。
展开全文
• iOS 各版本中的新特性（What's New in iOS）- 目录翻译完成


iOS 各版本中的新特性（What's New in iOS）
太阳火神的美丽人生 (http://blog.csdn.net/opengl_es)
本文遵循“署名-非商业用途-保持一致”创作公用协议
转载请保留此句：太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究：iOS、Android、Html5、Arduino、pcDuino，否则，出自本博客的文章拒绝转载或再转载，谢谢合作。

介绍 Introduction 文档组织结构 Organization of This Document
iOS 7.0

用户界面更改 User Interface Changes

UI重新设计 UI Redesign

视图动态行为 Dynamic Behaviors for Views

文本工具箱 Text Kit

64位支持 64-Bit Support

游戏 Games

精灵工具箱框架 Sprite Kit Framework

游戏控制器框架 Game Controller Framework

游戏中心改进 Game Center Improvements

地图 Maps

空中投放 AirDrop

应用内音频 Inter-App Audio

点对点联接 Peer-to-Peer Connectivity

新框架 New Frameworks

已有框架的加强 Enhancements to Existing Frameworks

UIKit框架 UIKit Framework

商店工具箱框架 Store Kit Framework

通行证工具箱框架 Pass Kit Framework

开放图形库嵌入式系统版本 OpenGL ES

消息用户界面框架 Message UI Framework

Media Player FrameworkMap Kit Framework

图象读写框架 Image I/O Framework

游戏工具箱框架 Game Kit Framework

基础框架 Foundation Framework

核心电话框架 Core Telephony Framework

核心动作框架 Core Motion Framework

核心位置框架 Core Location Framework

核心基础框架 Core Foundation Framework

核心蓝牙框架 Core Bluetooth Framework

音视频基础框架 AV Foundation Framework

加速框架 Accelerate Framework

Objective-C语言 Objective-C

弃用的API Deprecated APIs

iOS 6.1

地图开发包搜索组件 Map Kit Searches

iOS 6.0

地图 Maps

社交框架 Social Framework

通行证开发包 Pass Kit

游戏中心 Game Center

提醒 Reminders

应用内支付 In-App Purchase

集合视图 Collection Views

UI元素状态保持 UI State Preservation

自动布局 Auto Layout

数据私有 Data Privacy

UIKit 框架 UIKit Framework

开放嵌入式系统图形库 OpenGL ES

媒体播放框架 Media Player Framework

图像IO框架 Image IO Framework

基础框架 Foundation Framework

外设框架 External Accessory Framework

事件开发包框架 Event Kit Framework

核心视频框架 Core Video Framework

核心媒体柜架 Core Media Framework

核心位置框架 Core Location Framework

核心蓝牙框架 Core Bluetooth Framework
核心音频 Core Audio

音视频基础框架 AV Foundation Framework

促进框架 Accelerate Framework

iOS 5.1

文本输入视图中支持口述 Dictation Support in Text Input Views

iOS 5.0

iCloud云存储开发接口 iCloud Storage APIs

iCloud云备份 iCloud Backup

ARC自动引用计数 Automatic Reference Counting

故事板 Storyboards

创建故事板文件 Creating Storyboard Files

准备迁移到一个新的视图控制器 Preparing to Transition to a New View Controller

编码呈现故事板视图控制器 Presenting Storyboard View Controllers Programmatically

报摊支持 Newsstand Support

AirPlay无线播放改进 AirPlay Improvements

新框架 New Frameworks

OpenGLES图形库开发包框架 GLKit Framework

核心图形框架 Core Image Framework

帐户框架 Accounts Framework

通用安全服务框架 Generic Security Services Framework

核心蓝牙 Core Bluetooth

应用设计层面的改进 App Design-Level Improvements

文档支持 Document Support

数据保护的改进 Data Protection Improvements

UIKit控件的自定义呈现 Custom Appearance for UIKit Controls
容器视图控制器支持 Container View Controller Support

设置 Settings

XCode工具 Xcode Tools

XCode改进 Xcode Improvements

OpenGL ES调试 OpenGL ES Debugging

UI自动化的加强 UI Automation Enhancements

分析工具集 Instruments

用户界面开发包框架 UIKit

开放嵌入式系统图形库框架 OpenGL ES

开放音频库框架 OpenAL

消息用户界面框架 Message UI
媒体播放框架 Media Player
地图开发包框架 Map Kit

游戏开发包框架 Game Kit

基础框架 Foundation

外设框架 Accessory

事件开发包和事件开发包用户界面 Event Kit and Event Kit UI

核心动作框架 Core Motion

核心位置框架 Core Location
核心图形框架 Core Graphics

核心数据框架 Core Data

核心音频框架 Core Audio

音视频基础框架 AV Foundation
资料库框架 Assets Library

安全框架 Security

iOS 4.3

AirPlay无线视频支持 AirPlay Video Support

框架加强 Framework Enhancements

音视频基础框架 AV Foundation

核心音频框架 Core Audio Frameworks

媒体播放框架 Media Player

用户界面开发包框架 UIKit

iOS 4.2

打印 Printing

无线播放 AirPlay

核心音乐设备数字接口 Core MIDI

框架加强 Framework Enhancements

核心位置 Core Location

游戏开发包 Game Kit

媒体播放 Media Player

用户界面开发包 UIKit

iOS 4.1

游戏中心 Game Center

框架加强 Framework Enhancements

音视频基础 AV Foundation

资源库 Assets Library

核心文本 Core Text

系统配置 System Configuration

用户界面开发包 UIKit

iOS 4.0

集成技术 Integration Technologies

事件开发包 Event Kit

核心动作 Core Motion

数据保护 Data Protection

核心电话 Core Telephony

图形和多媒体 Graphics and Multimedia

高分辩率屏幕支持 High-Resolution Screen Support

快速查看框架 Quick Look Framework

音视频基础框架 AV Foundation

资源库 Assets Library

图像IO框架 Image I/O

核心媒体 Core Media

核心视频 Core Video

核心服务 Core Services

块对象 Block Objects

GCD异步中心分发执行框架 Grand Central Dispatch

加速促进框架 Accelerate Framework

Xcode 工具 Xcode Tools

Xcode 改进 Xcode Improvements

UI自动化开发接口 UI Automation API

框架加强 Framework Enhancements

UIKit框架加强 UIKit Framework Enhancements

Foundation框架加强 Foundation Framework Enhancements

OpenGL ES框架加强 OpenGL ES Enhancements

游戏开发包加强 Game Kit Enhancements

核心位置框架加强Core Location Enhancements

地图开发包框架加强 Map Kit Enhancements

消息用户界面加强 Message UI Enhancements

核心图形框架加强 Core Graphics Enhancements

ICU加强 ICU Enhancements

继承的改进 Inherited Improvements

文档修订历史 Document Revision History

介绍 Introduction
本文档描述不同版本iOS中引入的开发级特性。针对每一个版本发布，本文档都提供链接到增量引用文档，列出该发布版本中引入的新的和更新的编程接口。
This document describes developer-level features that were introduced in different versions of iOS. For each shipping release, this document provides links to “delta” reference documents, which list the new and changed programming interfaces that were introduced in that release.
文档组织结构 Organization of This Document
本文档包含如下的文章
This document includes the following articles:

“iOS 7.0”(page 8) 描述iOS 7.0中的新增和更新的特性。 “iOS 7.0”(page 8) describes the new and updated features in iOS 7.0.
“iOS 6.1”(page 25) describes the new and updated features in iOS 6.1.
“iOS 6.0”(page 26) describes the new and updated features in iOS 6.0.
“iOS 5.1”(page 38) describes the new and updated features in iOS 5.1.
“iOS 5.0”(page 39) describes the new and updated features in iOS 5.0.
“iOS 4.3”(page 62) describes the new and updated features in iOS 4.3.
“iOS 4.2”(page 65) describes the new and updated features in iOS 4.2.
“iOS 4.1”(page 69) describes the new and updated features in iOS 4.1.
“iOS 4.0”(page 71) describes the new and updated features in iOS 4.0.

iOS 7.0

iOS 7 is a major update with compelling features for developers to incorporate into their apps. The user interfacehas been completely redesigned. In addition, iOS 7 introduces a new animation system for creating 2D and2.5D games. Multitasking enhancements, peer-to-peer connectivity, and many other important features makeiOS 7 the most significant release since the first iPhone SDK.
This article summarizes the key developer-related features introduced in iOS 7. This version of the operatingsystem runs on current iOS devices. In addition to describing the key new features, this article lists the documentsthat describe those features in more detail.
For late-breaking news and information about known issues, seeiOS 7 Release Notes. For the complete list ofnew APIs added in iOS 7, seeiOS 7.0 API Diffs.
User Interface Changes
iOS 7 includes many new features intended to help you create great user interfaces.
UI Redesign
The iOS 7 user interface has been completely redesigned. Throughout the system, a sharpened focus onfunctionality and on the user’s content informs every aspect of design. Translucency, refined visual touches,and fluid, realistic motion impart clarity, depth, and vitality to the user experience. Whether you are creatinga new app or updating an existing one, keep these qualities in mind as you work on the design.
Apps compiled against the iOS 7 SDK automatically receive the new appearance for any standard system viewswhen the app is run on iOS 7. If you use Auto Layout to set the size and position of your views, those viewsare repositioned as needed. But there may still be additional work to do to make sure your interface has theappearance you want. Similarly, if you customize your app’s views, you may need to make changes to supportthe new appearance fully.
For guidance on how to design apps that take full advantage of the new look in iOS 7, seeiOS 7 Design Re-sources.

Dynamic Behaviors for Views
Apps can now specify dynamic behaviors forUIViewobjects and for other objects that conform to theUIDynamicItemprotocol. (Objects that conform to this protocol are calleddynamic items.) Dynamic behaviorsoffer a way to improve the user experience of your app by incorporating real-world behavior and characteristics,such as gravity, into your app’s animations. UIKit supports the following types of dynamic behaviors:
A UIAttachmentBehaviorobject specifies a connection between two dynamic items or between anitem and a point. When one item (or point) moves, the attached item also moves. The connection is notcompletely static, though. An attachment behavior has damping and oscillation properties that determinehow the behavior changes over time.
A UICollisionBehaviorobject lets dynamic items participate in collisions with each other and withthe behavior’s specified boundaries. The behavior also lets those items respond appropriately to collisions.
A UIGravityBehaviorobject specifies a gravity vector for its dynamic items. Dynamic items acceleratein the vector’s direction until they collide with other appropriately configured items or with a boundary.
A UIPushBehaviorobject specifies a continuous or instantaneous force vector for its dynamic items. A UISnapBehaviorobject specifies a snap point for a dynamic item. The item snaps to the point with a
configured effect. For example, it can snap to the point as if it were attached to a spring.
Dynamic behaviors become active when you add them to an animator object, which is an instance of theUIDynamicAnimatorclass. The animator provides the context in which dynamic behaviors execute. A givendynamic item can have multiple behaviors, but all of those behaviors must be animated by the same animatorobject.
For information about the behaviors you can apply, seeUIKit Framework Reference.
Text Kit
Text Kit is a full-featured set of UIKit classes for managing text and fine typography. Text Kit can lay out styledtext into paragraphs, columns, and pages; it easily flows text around arbitrary regions such as graphics; and itmanages multiple fonts. Text Kit is integrated with all UIKit text-based controls to enable apps to create, edit,display, and store text more easily—and with less code than was previously possible in iOS.
Text Kit comprises new classes and extensions to existing classes, including the following:
The NSAttributedStringclass has been extended to support new attributes. The NSLayoutManagerclass generates glyphs and lays out text. The NSTextContainerclass defines a region where text is laid out. The NSTextStorageclass defines the fundamental interface for managing text-based content.

64-Bit Support
Apps can now be compiled for the 64-bit runtime. All system libraries and frameworks are 64-bit ready, meaningthat they can be used in both 32-bit and 64-bit apps. When compiled for the 64-bit runtime, apps may runfaster because of the availability of extra processor resources in 64-bit mode.
iOS uses the same LP64 model that is used by OS X and other 64-bit UNIX systems, which means fewer problemswhen porting code. For information about the iOS 64-bit runtime and how to write 64-bit apps, see64-BitTransition Guide for Cocoa Touch.
iOS 7 supports two new background execution modes for apps:
Apps that regularly update their content by contacting a server can register with the system and belaunched periodically to retrieve that content in the background. To register, include theUIBackgroundModeskey with the fetchvalue in your app’sInfo.plistfile. Then, when your app islaunched, call thesetMinimumBackgroundFetchInterval:method to determine how often it receivesupdate messages. Finally, you must also implement theapplication:performFetchWithCompletionHandler:method in your app delegate.
Apps that use push notifications to notify the user that new content is available can fetch the content inthe background. To support this mode, include theUIBackgroundModeskey with theremote-notificationvalue in your app’sInfo.plistfile. You must also implement theapplication:didReceiveRemoteNotification:fetchCompletionHandler:method in your appdelegate.
Apps supporting either thefetchorremote-notificationbackground modes may be launched or movedfrom the suspended to background state at appropriate times. In the case of thefetchbackground mode,the system uses available information to determine the best time to launch or wake apps. For example, it doesso when networking conditions are good or when the device is already awake. You can also send silent pushnotifications—that is, notifications that do not display alerts or otherwise disturb the user.

For small content updates, use theNSURLRequestclass. To upload or download larger pieces of content inthe background, use the newNSURLSessionclass. This class improves on the existingNSURLConnectionclass by providing a simple, task-based interface for initiating and processingNSURLRequestobjects. A singleNSURLSessionobject can initiate multiple download and upload tasks, and use its delegate to handle anyauthentication requests coming from the server.
Games
iOS 7 includes enhanced support for games.
Sprite Kit Framework
The Sprite Kit framework (SpriteKit.framework) provides a hardware-accelerated animation systemoptimized for creating 2D and 2.5D games. Sprite Kit provides the infrastructure that most games need, includinga graphics rendering and animation system, sound playback support, and a physics simulation engine. UsingSprite Kit frees you from creating these things yourself, and it lets you focus on the design of your content andthe high-level interactions for that content.
Content in a Sprite Kit app is organized into scenes. A scene can include textured objects, video, path-basedshapes, Core Image filters, and other special effects. Sprite Kit takes those objects and determines the mostefficient way to render them onscreen. When it is time to animate the content in your scenes, you can useSprite Kit to specify explicit actions you want performed, or you can use the physics simulation engine to definephysical behaviors (such as gravity, attraction, or repulsion) for your objects.
In addition to the Sprite Kit framework, there are Xcode tools for creating particle emitter effects and textureatlases. You can use the Xcode tools to manage app assets and update Sprite Kit scenes quickly.
For more information about how to use Sprite Kit, seeSprite Kit Programming Guide. To see an example ofhow to use Sprite Kit to build a working app, seecode:Explained Adventure.
Game Controller Framework
The Game Controller framework (GameController.framework) lets you discover and configureMade-for-iPhone/iPod/iPad (MFi) game controller hardware in your app. Game controllers can be devicesconnected physically to an iOS device or connected wirelessly over Bluetooth. The Game Controller frameworknotifies your app when controllers become available and lets you specify which controller inputs are relevantto your app.

Game Center Improvements
Game Center includes the following improvements:
Turn-based matches now support a new feature known asexchanges. Exchanges let players initiate actionswith other players, even when it is not their turn. You can use this feature to implement simultaneousturns, player chats, and trading between players.
The limit on per-app leaderboards has been raised from 25 to 100. You can also organize your leaderboardsusing aGKLeaderboardSetobject, which increases the limit to 500.
You can add conditions to challenges that define when the challenge has been met. For example, achallenge to beat a time in a driving game might stipulate that other players must use the same vehicle.
The framework has improved its authentication support and added other features to prevent cheating.For more information about how to use the new Game Center features, seeGame Center Programming Guide.
For information about the classes of the Game Kit framework, seeGame Kit Framework Reference.
Maps
The Map Kit framework (MapKit.framework) includes numerous improvements and features for apps thatuse map-based information. Apps that use maps to display location-based information can now take fulladvantage of the 3D map support found in the Maps app, including controlling the viewing perspectiveprogrammatically. Map Kit also enhances maps in your app in the following ways:
Overlays can be placed at different levels in the map content so that they appear above or below otherrelevant data.
You can apply an MKMapCameraobject to a map to add position, tilt, and heading information to itsappearance. The information you specify using the camera object imparts a 3D perspective on the map.
The MKDirectionsclass lets you ask for direction-related route information from Apple. You can usethat route information to create overlays for display on your own maps.
The MKGeodesicPolylineclass lets you create a line-based overlay that follows the curvature of theearth.
Apps can use the MKMapSnapshotterclass to capture map-based images. The visual representation of overlays is now based on the MKOverlayRendererclass, which replaces
overlay views and offers a simpler rendering approach.

Apps can now supplement or replace a map’s existing tiles using theMKTileOverlayandMKTileOverlayRendererclasses.
AirDrop
AirDrop lets users share photos, documents, URLs, and other kinds of data with nearby devices. AirDrop supportis now built in to the existingUIActivityViewControllerclass. This class displays different options forsharing the content that you specify. If you are not yet using this class, you should consider adding it to yourinterface.
To receive files sent via AirDrop, do the following:
In Xcode, declare support for the document types your app supports. (Xcode adds the appropriate keysto your app’sInfo.plistfile.) The system uses this information to determine whether your app canopen a given file.
Implement the application:openURL:sourceApplication:annotation:method in your appdelegate. (The system calls this method when a new file is received.)
Files sent to your app are placed in theDocuments/Inboxdirectory of your app’s home directory. If you planto modify the file, you must move it out of this directory before doing so. (The system allows your app to readand delete files in this directory only.) Files stored in this directory are encrypted using data protection, so youmust be prepared for the file to be inaccessible if the device is currently locked.
Inter-App Audio
The Audio Unit framework (AudioUnit.framework) adds support for Inter-App Audio, which enables theability to send MIDI commands and stream audio between apps on the same device. For example, you mightuse this feature to record music from an app acting as an instrument or use it to send audio to another appfor processing. To vend your app’s audio data, publish a I/O audio unit (AURemoteIO) that is visible to otherprocesses. To use audio features from another app, use the audio component discovery interfaces in iOS 7.
For information about the new interfaces, see the framework header files. For general information about theinterfaces of this framework, seeAudio Unit Framework Reference.

Peer-to-Peer Connectivity
The Multipeer Connectivity framework (MultipeerConnectivity.framework) supports the discovery ofnearby devices and the direct communication with those devices without requiring Internet connectivity. Thisframework makes it possible to create multipeer sessions easily and to support reliable in-order data transmissionand real-time data transmission. With this framework, your app can communicate with nearby devices andseamlessly exchange data.
The framework provides programmatic and UI-based options for discovering and managing network services.Apps can integrate theMCBrowserViewControllerclass into their user interface to display a list of peerdevices for the user to choose from. Alternatively, you can use theMCNearbyServiceBrowserclass to lookfor and manage peer devices programmatically.
New Frameworks
iOS 7 includes the following new frameworks:
The Game Controller framework (GameController.framework) provides an interface for communicatingwithgame-relatedhardware;see“GameControllerFramework”(page11).
The Sprite Kit framework (SpriteKit.framework) provides support for sprite-based animations andgraphics rendering; see “Sprite Kit Framework”(page 11).
The Multipeer Connectivity framework (MultipeerConnectivity.framework) provides peer-to-peernetworking for apps; see “Peer-to-Peer Connectivity”(page 14).
The JavaScript Core framework (JavaScriptCore.framework) provides Objective-C wrapper classesfor many standard JavaScript objects. Use this framework to evaluate JavaScript code and parse JSONdata. For information about the classes of this framework, see the framework header files.
The Media Accessibility framework (MediaAccessibility.framework) manages the presentation ofclosed-captioned content in your media files. This framework works in conjunction with new settings thatlet the user enable the display of closed captions.
The Safari Services framework (SafariServices.framework) provides support for programmaticallyadding URLs to the user’s Safari reading list. For information about the class provided by this framework,see the framework header files.
Enhancements to Existing Frameworks

In addition to its new features, iOS 7 also includes significant enhancements, organized here by framework.For a complete list of new interfaces, seeiOS 7.0 API Diffs .
UIKit Framework
The UIKit framework (UIKit.framework) includes the following enhancements:
All UI elements have been updated to present the new look associated with iOS 7. UIKit Dynamics lets you mimic real-world effects such as gravity in your animations; see“Dynamic Behaviors
for Views”(page 9).
Text Kit provides sophisticated text editing and display capabilities; see“Text Kit”(page 9).
The UIViewclass defines the following additions:
The tintColorproperty applies a tint color to both the view and its subviews. For information on howto apply tint colors, seeiOS 7 UI Transition Guide.
You can create keyframe-based animations using views. You can also make changes to your views andspecifically prevent any animations from being performed.
The UIViewControllerclass defines the following additions: View controller transitions can be customized, driven interactively, or replaced altogether with ones you
designate.
View controllers can now specify their preferred status bar style and visibility. The system uses the providedinformation to manage the status bar style as new view controllers appear. You can also control how thisbehavior is applied using the UIViewControllerBasedStatusBarAppearancekey in your app’sInfo.plistfile.
The UIMotionEffectclass defines the basic behavior for motion effects, which are objects that definehow a view responds to device-based motion.
Collection views add support for intermediate layout transitions and invalidation contexts (invalidationcontexts help you improve the performance of your custom layout code). You can also apply UIKit Dynamicsto collection view layout attributes to animate the items in the collection.
The imageNamed:method ofUIImagesupports retrieving images stored in asset catalogs, which are away to manage and optimize assets that have multiple sizes and resolutions. You create asset catalogs inXcode.
There are methods on  UIViewandUIScreenfor creating a snapshot of their contents. Generatingsnapshots using these new interfaces is significantly faster than rendering the view or screen contentsyourself.
Gesture recognizers can specify dependencies dynamically to ensure that one gesture recognizer failsbefore another is considered.

The UIKeyCommandclass wraps keyboard events received from an external hardware keyboard. Theseevents are delivered to the app’s responder chain for processing.
A UIFontDescriptorobject describes a font using a dictionary of attributes. Use font descriptors tointeroperate with other platforms.
The UIFontandUIFontDescriptorclasses support dynamic text sizing, which improves legibility fortext in apps. With this feature, the user controls the desired font size that all apps in the system shoulduse.
The UIActivityclass now supports new activity types, including activities for sending items via AirDrop,adding items to a Safari reading list, and posting content to Flickr, Tencent Weibo, and Vimeo.
The UIApplicationDelegateprotocol adds methods for handling background fetch behaviors. The UIScreenEdgePanGestureRecognizerclass is a new gesture recognizer that tracks pan gestures
that originate near an edge of the screen.
UIKit adds support for running in a guided-access mode, which allows an app to lock itself to preventmodification by the user. This mode is intended for institutions such as schools, where users bring theirown devices but need to run apps provided by the institution.
State restoration now allows the saving and restoration of any object. Objects adopting theUIStateRestoringprotocol can write out state information when the app moves to the backgroundand have that state restored during subsequent launches.
Table views now support estimating the height of rows and other elements, which improves scrollingperformance.
You can now more easily configure aUISearchDisplayControllerobject to work with aUINavigationBarobject.
For information about the classes of this framework, seeUIKit Framework Reference.
Store Kit Framework
The Store Kit framework (StoreKit.framework) has migrated to a new receipt system that developers canuse to verify in-app purchases on the device itself. You can also use it to verify the app purchase receipt onthe server.
Pass Kit Framework

The Pass Kit framework (PassKit.framework) includes new APIs for adding multiple passes in a singleoperation.
These new features were added to the pass file format:
New keys specify the expiration date for a pass. You can specify that a pass is relevant only when it is in the vicinity of specific iBeacons.
New attributes control how a pass is displayed. You can group passes together, display links with customtext on the back of a pass, and control how time values are displayed on the pass.
You can now associate extra data with a pass. This data is available to your app but is not displayed to theuser.
You can designate which data detectors to apply to the fields of your passes. For information about how to use Pass Kit in your app, see Passbook Programming Guide. For information
about the pass file format, seePassbook Package Format Reference.
OpenGL ES
iOS 7 adds support for OpenGL ES 3.0 and adds new features to OpenGL ES 2.0.
OpenGL ES 3.0 includes as core functionality the features of many extensions supported in OpenGL ES 2.0on iOS. But OpenGL ES 3.0 also adds new features to the OpenGL ES shading language and new corefunctionality that has never been available on mobile processors before, including multiple render targetsand transform feedback. You can use OpenGL ES 3 to more easily implement advanced renderingtechniques, such as deferred rendering.
To create an OpenGL ES 3 context on devices that support it, pass thekEAGLRenderingAPIOpenGLES3constant to theinitWithAPI:method.
OpenGL ES 2 adds the following new extensions: The EXT_sRGBextension adds support for sRGB framebuffer operations.
The GL_EXT_pvrtc_sRGBextension adds support for sRGB texture data compressed in the PVRTCtexture compression format. (This extension is also supported in OpenGL ES 3.0).
The GL_EXT_draw_instancedandGL_EXT_instanced_arraysextensions can improve renderingperformance when your app draws multiple instances of the same object. You use a single call todraw instances of the same object. You add variation to each instance by specifying how fast eachvertex attribute advances or by referencing an ID for each instance in your shader.
Textures can be accessed in vertex shaders in both OpenGL ES 2.0 and 3.0. Query the value of theMAX_VERTEX_TEXTURE_IMAGE_UNITSattribute to determine the exact number of textures you canaccess. In earlier versions of iOS, this attribute always had a value of0.

For more information, see  OpenGL ES Programming Guide for iOSandiOS Device Compatibility Reference.
Message UI Framework
In the Message UI framework, theMFMessageComposeViewControllerclass adds support for attachingfiles to messages.
For information about the new interfaces, see the framework header files. For information about the classesof this framework, seeMessage UI Framework Reference.
Media Player Framework
In the Media Player framework, theMPVolumeViewclass provides support for determining whether wirelessroutes such as AirPlay and Bluetooth are available for the user to select. You can also determine whether oneof these wireless routes is currently active. For information about the new interfaces, see the framework headerfiles.
For information about the classes of Media Player framework, seeMedia Player Framework Reference.
Map Kit Framework
The Map Kit framework (MapKit.framework) includes changes that are described in “Maps”(page 12).For information about the classes of this framework, seeMap Kit Framework Reference.
Image I/O Framework
The Image I/O framework (ImageIO.framework) now has interfaces for getting and setting image metadata.For information about the new interfaces, see the framework header files. For information about the classes
of this framework, see  Image I/O Reference Collection.
The framework introduces new methods on theMPMoviePlayerControllerclass that let you run adsbefore a movie.

The framework extends the  UIViewControllerclass to make it easier to create ad-supported content.You can now configure your view controllers to display ads before displaying the actual content theymanage.
Game Kit Framework
The Game Kit framework (GameKit.framework) includes numerous changes, which are described in “GameCenter Improvements”(page 12).
For information about the classes of this framework, seeGame Kit Framework Reference.
Foundation Framework
The Foundation framework (Foundation.framework) includes the following enhancements:
The NSDataclass adds support for Base64 encoding.
The NSURLSessionclass is a new class for managing the acquisition of network-based resources. (Youcan use it to download content even when your app is suspended or not running.) This class serves as areplacement for theNSURLConnectionclass and its delegate; it also replaces theNSURLDownloadclassand its delegate.
The NSURLComponentsclass is a new class for parsing the components of a URL. This class supports theURI standard (rfc3986/STD66) for parsing URLs.
The NSNetServiceandNSNetServiceBrowserclasses support peer-to-peer discovery over Bluetoothand Wi-Fi.
The NSURLCredentialandNSURLCredentialStorageclasses let you create credentials with asynchronizable policy, and they provide the option of removing credentials with a synchronizable policyfrom iCloud.
The NSURLCache,NSURLCredentialStorage, andNSHTTPCookieStorageclasses now support theasynchronous processing of storage requests.
The NSCalendarclass supports new calendar types. The NSProgressclass provides a general-purpose way to monitor the progress of an operation and report
that progress to other parts of your app that want to use it.
For information about the new interfaces, see the framework header files and Foundation release notes. Forgeneral information about the classes of this framework, seeFoundation Framework Reference.

Core Telephony Framework
The Core Telephony framework (CoreTelephony.framework) lets you get information about the type ofradio technology in use by the device. Apps developed in conjunction with a carrier can also authenticateagainst a particular subscriber for that carrier.
For information about the new interfaces, see the framework header files. For general information about theclasses of the Core Telephony framework, seeCore Telephony Framework Reference.
Core Motion Framework
The Core Motion framework (CoreMotion.framework) adds support for step counting and motion tracking.With step counting, the framework detects movements that correspond to user motion and uses that informationto report the number of steps to your app. Because the system detects the motion, it can continue to gatherstep data even when your app is not running. Alongside this feature, the framework can also distinguishdifferent types of motion, including different motions reflective of travel by walking, by running, or byautomobile. Navigation apps might use that data to change the type of directions they give to users.
For information about the classes of this framework, seeCore Motion Framework Reference.
Core Location Framework
The Core Location framework (CoreLocation.framework) supports region monitoring and ranging usingBluetooth devices. Region monitoring lets you determine whether the iOS device enters a specific area, andranging lets you determine the relative range of nearby Bluetooth devices. For example, an art museum mightuse region monitoring to determine whether a person is inside a particular gallery, and then place iBeaconsnear each painting. When the person is standing by a painting, the app would display information about it.
The framework also supports deferring the delivery of location updates until a specific time has elapsed or theuser has moved a minimum distance.
For general information about the classes of this framework, seeCore Location Framework Reference.
Core Foundation Framework
The Core Foundation framework (CoreFoundation.framework) now lets you schedule stream objects ondispatch queues.
For information about the new interfaces, see the framework header files. For general information about theinterfaces of this framework, seeCore Foundation Framework Reference.

Core Bluetooth Framework
The Core Bluetooth framework (CoreBluetooth.framework) includes the following enhancements:
The framework supports saving state information for central and peripheral objects and restoring thatstate at app launch time. You can use this feature to support long-term actions involving Bluetooth devices.
The central and peripheral classes now use anNSUUIDobject to store unique identifiers.You can now retrieve peripheral objects from a central manager synchronously.
For information about the classes of this framework, seeCore Bluetooth Framework ReferenceandCore BluetoothProgramming Guide.
AV Foundation Framework
The AV Foundation framework (AVFoundation.framework) includes the following enhancements:
The AVAudioSessionclass supports the following new behaviors: Selecting the preferred audio input, including audio from built-in microphones
Multichannel input and output

The AVVideoCompositingprotocol and related classes let you support custom video compositors.

The AVSpeechSynthesizerclass and related classes provide speech synthesis capabilities.
The capture classes add support and interfaces for the following features:
Discovery of a camera’s supported formats and frame rates High fps recording Still image stabilization Video zoom (true and digital) in recordings and video preview, including custom rampingReal-time discovery of machine-readable metadata (barcodes)
Autofocus range restriction Smooth autofocus for capture Sharing your app’s audio session during captureAccess to the clocks used during capture
Recommended settings for use with data outputs and asset writer

There are new metadata key spaces for supported ISO formats such as MPEG-4 and 3GPP, and improvedsupport for filtering metadata items when copying those items from source assets to output files usingtheAVAssetExportSessionclass.

The AVAssetWriterclass provides assistance in formulating output settings, and there are new levelconstants for H.264 encoding.
The AVPlayerLayerclass adds thevideoRectproperty, which you can use to get the size and positionof the video image.
The AVPlayerItemclass supports the following changes: Asset properties can be loaded automatically when AVPlayerItemobjects are prepared for playback.
When you link your app against iOS 7 SDK, the behavior when getting the values of player itemproperties—such as theduration,tracks, orpresentationSizeproperties—is different fromthe behaviors in previous versions of iOS. The properties of this class now return a default value andno longer block your app if theAVPlayerItemobject is not yet ready to play. As soon as the playeritem’s status changes toAVPlayerItemStatusReadyToPlay, the getters reflect the actual valuesof the underlying media resource. If you use key-value observing to monitor changes to the properties,your observers are notified as soon as changes are available.

The AVPlayerItemLegibleOutputclass can process timed text from media files. The AVAssetResourceLoaderDelegateprotocol now supports loading of arbitrary ranges of bytes
from a media resource. For information about the new interfaces, see the framework header files. For general information about the
classes of this framework, seeAV Foundation Framework Reference.
Accelerate Framework
The Accelerate framework (Accelerate.framework) includes the following enhancements:
Improved support for manipulating Core Graphics data types Support for working with grayscale images of 1, 2, or 4 bits per pixel New routines for converting images between different formats and transforming image contentsSupport for biquad (IIR) operations
For information about the new interfaces, see the framework header files. For general information about thefunctions and types of this framework, seeAccelerate Framework Reference.
Objective-C

The Objective-C programming language has been enhanced to support modules, which yield faster builds andshorter project indexing times. Module support is enabled in all new projects created using Xcode 5. If youhave existing projects, you must enable this support explicitly by modifying your project’s Enable Modulessetting.
Deprecated APIs
From time to time, Apple adds deprecation macros to APIs to indicate that those APIs should no longer beused in active development. When a deprecation occurs, it is not an immediate end-of-life to the specified API.Instead, it is the beginning of a grace period for transitioning off that API and onto newer and more modernreplacements. Deprecated APIs typically remain present and usable in the system for a reasonable amount oftime past the release in which they were deprecated. However, active development on them ceases and theAPIs receive only minor changes—to accommodate security patches or to fix other critical bugs. DeprecatedAPIs may be removed entirely from a future version of the operating system.
As a developer, it is important that you avoid using deprecated APIs in your code as soon as possible. At aminimum, new code you write should never use deprecated APIs. And if you have existing code that usesdeprecated APIs, update that code as soon as possible. Fortunately, the compiler generates warnings wheneverit spots the use of a deprecated API in your code, and you can use those warnings to track down and removeall references to those APIs.
This release includes deprecations in the following technology areas:
The Map Kit framework includes deprecations for theMKOverlayViewclass and its various subclasses.The existing overlay views have been replaced with an updated set of overlay renderer objects that descendfrom theMKOverlayRendererclass. For more information about the classes of this framework, seeMapKit Framework Reference.
The Audio Session API in the Audio Toolbox framework is deprecated. Apps should use theAVAudioSessionclass in the AV Foundation framework instead.
The CLRegionclass in the Core Location framework is replaced by theCLCircularRegionclass. TheCLRegionclass continues to exist as an abstract base class that supports both geographic and beaconregions.
The UUIDproperty of theCBCentralclass is deprecated. To specify the unique ID of your central objects,use theidentifierproperty instead.
The Game Kit framework contains assorted deprecations intended to clean up the existing API and providebetter support for new features.
The UIKit framework contains the following deprecations:
The wantsFullScreenLayoutproperty ofUIViewControlleris deprecated. In iOS 7 and later,view controllers always support full screen layout.

UIColorobjects that provided background textures for earlier versions of iOS are gone.
Many drawing additions to theNSStringclass are deprecated in favor of newer variants.Thegethostuuidfunction in thelibsyscalllibrary is deprecated.
In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value02:00:00:00:00:00. If you need to identify the device, use the identifierForVendorproperty ofUIDeviceinstead. (Apps that need an identifier for their own advertising purposes should consider usingtheadvertisingIdentifierproperty of ASIdentifierManagerinstead.)
For a complete list of specific API deprecations, seeiOS 7.0 API Diffs.

iOS 6.1
This article summarizes the key developer-related features introduced in iOS 6.1. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.
For late-breaking news and information about known issues, seeiOS 6.1 Release Notes. For the complete listof new APIs added in iOS 6.1, seeiOS 6.1 API Diffs.
Map Kit Searches
The Map Kit framework now lets you programmatically search for map-based addresses and points of interest.TheMKLocalSearchclass initiates a search for map-based content using a natural language string. In otherwords, you can enter place name information or portions of an address and have Map Kit return search resultsthat match the information you provide. For example, searching for the string “coffee” would return the locationof local coffee bars along with information about each one.
For more information about the classes of the Map Kit framework, including the new search-related classes,seeMap Kit Framework Reference.

iOS 6.0
This article summarizes the key developer-related features introduced in iOS 6. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.
For late-breaking news and information about known issues, seeiOS 6.0 Release Notes. For the complete listof new APIs added in iOS 6, seeiOS 6.0 API Diffs.
Maps
In addition to the new map tiles provided by Apple, the Maps app and MapKit framework now support additionalinteractions with other apps. Apps that do not incorporate their own map support now have an easier way tolaunch the Maps app and display points of interest or directions. Apps that offer routing information, such asturn-by-turn navigation services, can now register as a routing app and make those services available to theentire system.
Registering as a routing app gives you more opportunities to get your app in front of users. Routing apps arenot limited to just driving or walking directions. Routing apps can also include apps that provide directionsfor the user’s favorite bicycle or hiking trail, for air routes, and for subway or other public transportation lines.And your app does not even have to be installed on the user’s device. Maps knows about routing apps in theApp Store and can provide the user with the option to purchase those apps and use them for directions.
Apps that do not provide routing directions themselves can also take advantage of both Maps and routingapps. Apps can use new interfaces to ask the Maps app to display specific locations or to display routingdirections between two locations.
For information about how to provide directions from your app, or how to use the Maps app to display directions,seeLocation and Maps Programming Guide.

iOS 6.0
Social Framework
Social Framework
The Social framework (Social.framework) provides a simple interface for accessing the user’s social mediaaccounts. This framework supplants the Twitter framework that was introduced in iOS 5 and adds support forother social accounts, including Facebook and Sina’s Weibo service. Apps can use this framework to post statusupdates and images to a user’s account. This framework works with the Accounts framework to provide asingle sign-on model for the user and to ensure that access to the user’s account is approved.
The UIKit framework also provides a newUIActivityViewControllerclass for displaying actions that theuser might perform on some selected content. One use of this class is to allow the user to post content tosocial accounts, such as Twitter or Facebook. You present this class modally on iPhone or using a popovercontroller on iPad. When the user taps one of the buttons, the view controller presents a new interface toperform the associated action.
Pass Kit
Pass Kit is a new technology that uses web services, a new file format, and an Objective-C framework(PassKit.framework) to implement support for downloadable passes. Companies can create passes torepresent items such as coupons, boarding passes, event tickets, and discount cards for businesses. Instead ofcarrying a physical representation of these items, users can now store them on their iOS device and use themthe same way as before.
Passes are created by your company’s web service and delivered to the user’s device via email, Safari, or yourcustom app. The pass itself uses a special file format and is cryptographically signed before being delivered.The file format identifies relevant information about the service being offered so that the user knows what itis for. It might also contain a bar code or other information that you can then use to validate the card so thatit can be redeemed or used.
Game Center
Game Center has been updated and new features have been added to improve the game playing experience.The Game Kit framework (GameKit.framework) includes the following incremental and major changes:

iOS 6.0
Reminders
Challenges allow a player to challenge a friend to beat an achievement or score. Players can issue challengesfrom the Game Center app. You can also use theGKChallengeclass to issue challenges from within yourgame.
The GKGameCenterViewControllerclass incorporates all of the previous capabilities of the leaderboard,achievement and friend request view controllers. You can use the previous view controllers too, but theynow present the appropriate tab in the game center view controller.
The process for authenticating a local player has changed. In the new process, you set theauthenticateHandlerproperty to a block that performs all the authentication steps. Once set, GameKit automatically authenticates the local player when necessary. However, Game Kit does not display theauthentication interface directly. Instead, it lets your handler present the provided authentication viewcontroller, giving you more control over exactly when the authentication user interface appears.
The turn-based match class now has support for player timeouts. When using a timeout, you specify a listof players in order. If a player times out, the next player in the list is asked to take a turn instead.
The GKMatchmakerclass has been updated to include better support for programmatic matchmaking.It is now easier to implement your own user interface for matchmaking on top of Game Center’s built-insupport.
The GKPlayerclass now supports display names for players.
The GKMatchclass provides a method to estimate which player has the best connection to Game Center.You can use this method when implementing your own client-server architecture on top of theGKMatchinfrastructure.
The GKAchievementclass now allows multiple achievements to be submitted at the same time.For more information about how to use Game Center in your app, seeGame Center Programming Guide.
Reminders
The Event Kit framework now includes interfaces for creating and accessing reminders on the user’s device.The reminders you create show up in the Reminders app along with ones created by the user. Reminders caninclude proximity or time-based alarms.
For more information about the interfaces of the Event Kit framework, including the new interfaces for creatingreminders, seeEvent Kit Framework Reference.
In-App Purchase

The Store Kit framework (StoreKit.framework) now supports the purchasing of iTunes content inside yourapp and provides support for having downloadable content hosted on Apple servers. With in-app contentpurchases, you present a view controller that lets users purchase apps, music, books, and other iTunes contentdirectly from within your app. You identify the items you want to make available for purchase but the rest ofthe transaction is handled for you by Store Kit.
Collection Views
The UICollectionViewclass offers a new way to present ordered data to users. With a collection view object,you are now able to define the presentation and arrangement of embedded views. The collection view classworks closely with an accompanying layout object to define the placement of individual data items. UIKitprovides a standard flow-based layout object that you can use to implement multi-column grids containingitems of standard or varying sizes. And if you want to go beyond grid layouts, you can create your own customlayout objects to support any layout style you choose.
Collection views work with a dedicated group of classes to support the display of items. In addition to cells,collection views can have supplementary views and decoration views. The usage and placement of these viewsis controlled entirely by the layout object. For example, the flow-based layout object uses supplementary viewsto implement header and footer views for sections in the collection view.
Other noteworthy features of collection views include:
A UICollectionViewControllerclass for managing the presentation of collection views in your appSupport for animating content within the collection view Batch support for inserting, moving, and deleting items A simplified model for creating and managing cells and other views
UI State Preservation

State preservation makes it easier for apps to restore their user interface to the state it was in when the userlast used it. Prior to iOS 6, apps were encouraged to write out information about their current interface statein the event that the app was terminated. Upon relaunch, the app could use this state to restore its interfaceand make it seem as if the app had never quit. State preservation simplifies this process by providing you withall of the core infrastructure for saving and restoring your app’s interface.
Implementing state preservation still requires effort on your part to identify what parts of your interface tosave. In addition, the preservation and restoration processes can be customized to accommodate unforeseencircumstances, such as missing content during a subsequent relaunch or changes to your app’s UI.
Auto Layout
Auto layout improves upon the “springs and struts” model previously used to lay out the elements of a userinterface. With auto layout, you define rules for how to lay out the elements in your user interface. These rulesexpress a larger class of relationships and are more intuitive to use than springs and struts.
The entities used in Auto Layout are Objective-C objects called constraints. This approach brings you a numberof benefits:
Localization through swapping of strings alone, instead of also revamping layouts.
Mirroring of user-interface elements for right-to-left languages like Hebrew and Arabic.
Better layering of responsibility between objects in the view and controller layers.
A view object usually knows best about its standard size and its positioning within its superview andrelative to its sibling views. A controller can override these values if something nonstandard is required.
Data Privacy
In addition to location data, the system now asks the user’s permission before allowing third-party apps toaccess certain user data, including:

RemindersPhoto Library

For contact, calendar, and reminder data, your app needs to be prepared to be denied access to these itemsand to adjust its behavior accordingly. If the user has not yet been prompted to allow access, the returnedstructure is valid but contains no records. If the user has denied access, the app receives aNULLvalue or nodata. If the user grants permission to the app, the system subsequently notifies the app that it needs to reloador revert the data.
For the photo library, the existing interface supports the app being denied access.
Your app can provide a description for how it intends to use the data in itsInfo.plistfile. That data is thendisplayed to the user when the system needs to prompt for access. For more information about the keys youneed to add to yourInfo.plistfile, see Information Property List Key Reference. For more information aboutaccessing specific kinds of data, see the respective framework reference.
In addition to the items discussed in the preceding sections, the following frameworks have additionalenhancements. For a complete list of new interfaces, seeiOS 6.0 API Diffs .
UIKit Framework
The UIKit framework (UIKit.framework)includes the following enhancements:
UIKit now supports state preservation for your app’s user interface; see“UI State Preservation”(page 30).Views now support constraint-based layout; see“Auto Layout”(page 30).
The UICollectionViewclass (and its supporting classes and protocols) support the presentation ofordered collections of items; see“Collection Views”(page 29).
UITextViewandUITextFieldnow support styled text using attributed strings. UIKit now includes support for drawing NSAttributedStringandNSMutableAttributedString
objects. In addition, string-based views now support attributed strings for content.Accessibility support has been improved to include new VoiceOver enhancements:
VoiceOver can now use gestures to trigger specific actions.
Developers can order items together in the element list that VoiceOver creates to provide a morelogical flow from element to element.
Scroll views can now provide a special status string during scrolling.
You can now post notifications that let the accessibility system know your app’s layout or UI havechanged.

The UIDeviceclass adds a vendor-specific identifier.
The UIImageclass includes new initialization methods for specifying the scale factor of an image.
Appearance customization support has been added to theUIBarButtonItem,UIPageControl,UIPageViewController,UISwitch, andUIStepperclasses.
The UITableViewclass includes the following changes: Support for a new UITableViewHeaderFooterViewclass implements the table’s headers and
footers
A simplified model for creating and managing cells and other views.

The UITableViewControllerclass allows you to add a built-in refresh control (UIRefreshControl)to reload the table contents.

Storyboards allow you to unwind segues and specify restoration identifiers.
The UIWebViewclass provides a way to disable the incremental rendering of web content.
The UIViewControllerclass has new interfaces supporting the following behaviors:
New interfaces provide a clearer path for managing and tracking interface rotations.You can prevent a segue from being triggered. Support has been added for unwinding segues.

For information about the classes of the UIKit framework, seeUIKit Framework Reference.
OpenGL ES
OpenGL ES includes the following new extensions:
The GL_EXT_texture_storageextension allows your app to specify the entire structure of a texture in asingle call, allowing your textures to be optimized further by OpenGL ES.
The GL_APPLE_copy_texture_levelsextension builds on top of the functionality of theGL_EXT_texture_storageextension and allows a set of texture mipmaps to be copied from one textureto another.
The GL_EXT_map_buffer_rangeextension improves performance when you only need to modify a subsetof a buffer object.

The GL_APPLE_syncextension provides fine-grain synchronization to your app. It allows you to choose asubset of submitted OpenGL ES commands and block until those commands complete.
These extensions are available on all devices capable of running iOS 6. As always, check for the existence ofan extension before using it in your application.
Media Player Framework
The MPVolumeViewclass now provides interfaces for customizing the appearance of the volume view. Youcan use these interfaces to change the images associated with the volume slider and routing button.
For information about the classes of the Media Player framework, seeMedia Player Framework Reference.
Image IO Framework
The Image IO framework (ImageIO.framework) includes support for accessing EXIF and IPTC metadataproperties for images. You can access this metadata using functions associated with theCGImageSourceRefandCGImageDestinationRefopaque types.
For information about the classes of the Image IO framework, seeImage I/O Reference Collection.
Foundation Framework
The Foundation framework (Foundation.framework) includes the following enhancements:
The NSFileManagerclass includes theubiquityIdentityTokenmethod for determining the availabilityof iCloud, and theNSUbiquityIdentityDidChangeNotificationnotification for responding to auser logging into or out of iCloud, or changing accounts.
The NSUUIDclass helps you create objects that represent various types of UUIDs (Universally UniqueIdentifiers). For example, you can create anNSUUIDobject with RFC 4122 version 4 random bytes, or youcan base it on an existing UUID string.
The NSURLRequestclass lets you specify whether a request should be allowed to happen over a cellularnetwork.

The NSStringclass has new methods for converting a string to uppercase, lowercase, or an initial capitalcase.
For information about the classes of the Foundation framework, seeFoundation Framework Reference.
External Accessory Framework
The External Accessory framework (ExternalAccessory.framework) includes new interfaces for managingconnections to Bluetooth devices. Apps can now post an alert panel that lists the Bluetooth devices availablefor pairing. Support is also provided for waking previously paired accessories that do not automatically connect.
For information about the classes of the External Accessory framework, seeExternal Accessory FrameworkReference.
Event Kit Framework
The Event Kit framework (EventKit.framework) includes the following enhancements:
The framework supports the creation of reminders; see“Reminders”(page 28).
Calendar and reminder events can now vend an external identifier that lets multiple devices refer to thesame event on the server. The server provides the actual identifier string, which is accessed using thecalendarItemExternalIdentifierproperty ofEKCalendarItem.
For apps linked against iOS 6 and later, the system asks for the user’s permission before granting accessto calendar and reminder data.
Apps can now cancel editing programmatically from anEKEventEditViewControllerobject. For information about the classes of the Event Kit framework, see Calendar and Reminders Programming Guide.
Core Video Framework
The Core Video framework (CoreVideo.framework) adds support for two new pixel formats. These formatsprovide efficient storage for one-channel and two-channel images that interoperate with OpenGL ES. Forinformation about the functions of the Core Video framework, seeCore Video Framework Reference.
Core Media Framework

The Core Media framework (CoreMedia.framework) adds the CMClockRefandCMTimebaseReftypes,which define fundamental media time service behaviors. For information about the functions of the Core Mediaframework, seeCore Media Framework Reference.
Core Location Framework
The Core Location framework (CoreLocation.framework) includes the following changes.
The CLLocationManagerobject now pauses the delivery of location events when the user has not movedfor an extended period of time. This behavior saves power by allowing the framework to turn off the GPSand other hardware. It is enabled by default but may be disabled by changing the value in thepausesLocationUpdatesAutomaticallyproperty of the location manager object.
You can refine location accuracy based on usage by assigning an appropriate value to theactivityTypeproperty ofCLLocationManager. This property currently lets you distinguish between driving usageand fitness usage.
The framework supports improved location accuracy while offline and driving. For information about the classes of the Core Location framework, see Core Location Framework Reference.
Core Bluetooth Framework
The Core Bluetooth framework (CoreBluetooth.framework) supports interacting with Bluetooth devicesin peripheral mode. Previously, an iOS device could only interact in central mode but it can advertise itself inperipheral mode and communicate with other iOS devices.
For information about the classes of the Core Bluetooth framework, seeCore Bluetooth Framework Reference.
Core Audio
Core Audio family of frameworks includes the following changes:
There is a new AUDeferredRenderer audio unit that allows audio to be processed on a lower-priority threadusing relatively larger time slices.
The AudioQueueProcessingTap audio unit allows you to intercept the data in an audio queue and processit.
For information about the audio technologies available in iOS, seeMultimedia Programming Guide. Forinformation about the new audio units, seeAudio Unit Component Services Reference.
AV Foundation Framework

The AV Foundation framework (AVFoundation.framework) includes the following enhancements:
The AVPlayerclass adds support for syncing playback to an external time source. A single player objectcan also play both HTTP Live Streams and file-based assets (including both local files and files that areprogressively downloaded). And you can use multipleAVPlayerLayerobjects to display the visual outputof the same player object.
The new AVPlayerItemOutputclass works with an AVPlayerItemobject to obtain decoded videoframes during playback so that your app can process them.
The AVAssetResourceLoaderclass allows you to insert a delegate object into the asset loading processand handle custom resource requests. This class works with theAVURLAssetclass.
The AVAudioSessionclass now exposes information about the current audio route in use. The AVAudioMixInputParametersclass provides access to anMTAudioProcessingTapRefdata type,
which can be used to access audio data before it is played, read, or exported.
The AVAudioSessionclass includes the following enhancements: Use of an audio session delegate to detect interruptions and changes is now deprecated in favor of
Audio sessions support a new audio category,AVAudioSessionCategoryMultiRoute, that allowsrouting of audio to and from multiple audio hardware devices.
Audio sessions support a new mode,AVAudioSessionModeMoviePlayback, that engagesappropriate output signal processing for movie playback scenarios.

The AVCaptureConnectionclass allows you to enable or disable support for video stabilization onincoming video.

The AVCaptureMetadataOutputclass is a new class for intercepting metadata emitted by a captureconnection object.
The AVMetadataFaceObjectis a new class that reports the face-detection data captured by anAVCaptureMetadataOutputobject.
The AVTextStyleRuleclass is a new class for specifying style options for subtitles, closed captions, andother text-related media assets.
The AVAudioPlayerclass can play audio items from the user’s iPod library using URLs obtained fromtheMPMediaLibraryclass. You can also set channel assignments using thechannelAssignmentsproperty.
For information about the classes of the AV Foundation framework, seeAV Foundation Framework Reference.

The Ad Support framework (AdSupport.framework) is a new framework that provides access to an identifierthat apps can use for advertising purposes. This framework also provides a flag that indicates whether the userhas opted out of ad tracking. Apps are required to read and honor the opt-out flag before trying to access theadvertising identifier.
Accelerate Framework
The Accelerate framework (Accelerate.framework) includes new vector-scalar power functions, vDSPfunctions, discrete cosine transform functions, SSE-related vector functions, sine functions, and vImage functions.
For information about the functions of the Accelerate framework, seeAccelerate Framework Reference.

iOS 5.1

This article summarizes the key developer-related features introduced in iOS 5.1. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.
For late-breaking news and information about known issues, seeiOS 5.1 Release Notes. For the complete listof new APIs added in iOS 5.1, seeiOS 5.1 API Diffs.
Dictation Support in Text Input Views
On supported devices, iOS automatically inserts recognized phrases into the current text view when the userhas chosen dictation input. The newUIDictationPhraseclass (declared in UITextInput.h) provides youwith a string representing a phrase that a user has dictated. In the case of ambiguous dictation results, thenew class provides an array containing alternative strings. New methods in theUITextInputprotocol allowyour app to respond to the completion of dictation.

iOS 5.0
This article summarizes the key developer-related features introduced in iOS 5.0. This version of the operatingsystem runs on current iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.
For late-breaking news and information about known issues, seeiOS 5.0 Release Notes. For the complete listof new APIs added in iOS 5.0, seeiOS 5.0 API Diffs.
iCloud Storage APIs
The iCloud storage APIs let your app write user documents and data to a central location and access thoseitems from all of a user’s computers and iOS devices. Making a user’s documents ubiquitous using iCloudmeans that a user can view or edit those documents from any device without having to sync or transfer filesexplicitly. Storing documents in a user’s iCloud account also provides a layer of security for that user. Even ifa user loses a device, the documents on that device are not lost if they are in iCloud storage.
There are two ways that apps can take advantage of iCloud storage, each of which has a different intendedusage:
iCloud document storage—Use this feature to store user documents and data in the user’s iCloud account.iCloud key-value data storage—Use this feature to share small amounts of data among instances of your
app.
Most apps will use iCloud document storage to share documents from a user’s iCloud account. This is thefeature that users think of when they think of iCloud storage. A user cares about whether documents are sharedacross devices and can see and manage those documents from a given device. In contrast, the iCloud key-valuedata store is not something a user would see. It is a way for your app to share small amounts of data (up to aper-app total of 1 MB and a maximum of 1,024 keys) with other instances of itself. Apps can use this featureto store important state information. A magazine app might save the issue and page that the user read last,while a stocks app might store the stock symbols the user is tracking.
For information on how to use iCloud document and key-value data storage, seeiCloud Design Guide.

●
●

iOS 5.0
iCloud Backup
iCloud Backup
Users can now opt to have their apps and app data backed up directly to their iCloud account, making it easierto restore apps to their most recent state. Having data backed up in iCloud makes it easy for a user to reinstallthat data to a new or existing iOS device. However, because the amount of space in a user’s iCloud account islimited, apps must be even more selective about where they store files.
The placement of files in your app’s home directory determines what gets backed up and what does not.Anything that would be backed up to a user’s computer is also backed up wirelessly to iCloud. Thus, everythingin the Documentsdirectory and most (but not all) of your app’sLibrarydirectory. To minimize the amountof data stored in the user’s iCloud account, developers are encouraged to put more files in theLibrary/Cachesdirectory, especially if those files can be easily re-created or obtained in another way.
Note:AnydocumentsthatyourappstoresexplicitlyiniCloud(usingtheiCloudstorageAPIs)arenot backed up with your app. (Those documents are already stored in the user’s iCloud account andtherefore do not need to be backed up separately.)
For information on which directories are backed up, and for information about iCloud document storage, seeiOS App Programming Guide.

iOS 5.0
Automatic Reference Counting
Automatic Reference Counting
Automatic Reference Counting (ARC)is a compiler-level feature that simplifies the process of managing thelifetimes of Objective-C objects. Instead of you having to remember when to retain or release an object, ARCevaluates the lifetime requirements of your objects and automatically inserts the appropriate method calls atcompile time.

Reference counting manually

Automatic Reference Counting

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

retain/release code

{app_code}

{app_code}

{app_code}

{app_code}

{app_code}

Time to produce

Time to produce

To be able to deliver these features, ARC imposes some restrictions—primarily enforcing some best practicesand disallowing some other practices:
Do not call the retain,release,autorelease, ordeallocmethods in your code.
In addition, you cannot implement customretainorreleasemethods.
Because you do not call thereleasemethod, there is often no need to implement a customdeallocmethod—the compiler synthesizes all that is required to relinquish ownership of instance variables. Youcan provide a custom implementation ofdeallocif you need to manage other resources.
Do not store object pointers in C structures. Store object pointers in other objects instead of in C structures. Do not directly cast between object and nonobject types (for example, between  idandvoid*).

●
●
●

iOS 5.0
Automatic Reference Counting
You must use special functions or casts that tell the compiler about an object’s lifetime. You use these tocast between Objective-C objects and Core Foundation objects.
You cannot use NSAutoreleasePoolobjects. Instead, you must use a new @autoreleasepoolkeyword to mark the start of an autorelease block. The
contents of the block are enclosed by curly braces, as shown in the following example:

●

@autoreleasepool
{

}

ARC encourages you to think in terms of object graphs, and the relationships between objects, rather than interms of retain and release. For this reason, ARC introduces new lifetime qualifiers for objects, including zeroingweak references. The value of a zeroing weak reference is automatically set tonilif the object to which itpoints is deallocated. There are qualifiers for variables, and newweakandstrongdeclared property attributes,as illustrated in the following examples:

// The following declaration is a synonym for: @property(retain) MyClass *myObject;@property(strong) MyClass *myObject;
// The following declaration is similar to "@property(assign) MyOtherClass
*delegate;"

// except that if the MyOtherClass instance is deallocated,
// the property value is set to nil instead of remaining as a dangling pointer
@property(weak) MyOtherClass *delegate;

Xcode provides migration tools to help convert existing projects to use ARC. For more information about howto perform this migration, seeWhat's New in Xcode. For more information about ARC itself, seeTransitioningto ARC Release Notes.

iOS 5.0
Storyboards
Storyboards
Storyboards are the new way to define your app’s user interface. In the past, you used nib files to define youruser interface one view controller at a time. A storyboard file captures your entire user interface in one placeand lets you define both the individual view controllers and the transitions between those view controllers.As a result, storyboards capture the flow of your overall user interface in addition to the content you present.
If you are creating new apps, the Xcode templates come preconfigured to use storyboards. For other apps,the process for using storyboards is as follows:
Configure your app’s Info.plistfile to use storyboards: Add the UIMainStoryboardFilekey and set its value to the name of your storyboard file. Remove the existing NSMainNibFilekey. (Storyboards replace the main nib file.)  Create and configure the storyboard file in Xcode; see“Creating Storyboard Files”(page 43).  Update your view controllers to handle storyboard transitions; see“Preparing to Transition to a New ViewController”(page 44).  If you ever need to present a view controller manually (perhaps to support motion-related events), usethe storyboard classes to retrieve and present the appropriate view controller; see“Presenting StoryboardView Controllers Programmatically”(page 44).
Apps can use a single storyboard file to store all of their view controllers and views. At build time, InterfaceBuilder takes the contents of the storyboard file and divides it up into discrete pieces that can be loadedindividually for better performance. Your app never needs to manipulate these pieces directly, though. All youmust do is declare the main storyboard in your app’sInfo.plistfile. UIKit handles the rest.
Creating Storyboard Files
You use Interface Builder to create storyboard files for your app. Most apps need only one storyboard file, butyou can create multiple storyboard files if you want. Every storyboard file has a view controller known as theinitial view controller. This view controller represents the entry point into the storyboard. For example, inyour app’s main storyboard file, the initial view controller would be the first view controller presented by yourapp.
Each view controller in a storyboard file manages a single scene. For iPhone apps, ascenemanages one screen’sworth of content, but for iPad apps the content from multiple scenes can be on screen simultaneously. To addnew scenes to your storyboard file, drag a view controller from the library to the storyboard canvas. You canthen add controls and views to the view controller’s view just as you would for a nib file. And as before, youcan configure outlets and actions between your view controller and its views.

●
●

iOS 5.0
Storyboards
When you want to transition from one view controller to another, Control-click a button, table view cell, orother trigger object in one view controller, and drag to the view controller for a different scene. Draggingbetween view controllers creates a segue, which appears in Interface Builder as a configurable object. Seguessupport all of the same types of transitions available in UIKit, such as modal transitions and navigation transitions.You can also define custom transitions and transitions that replace one view controller with another.
Preparing to Transition to a New View Controller
Whenever a user triggers a segue in the current scene, the storyboard runtime calls theprepareForSegue:sender:method of the current view controller. This method gives the current viewcontroller an opportunity to pass any needed data to the view controller that is about to be displayed. Whenimplementing your view controller classes, you should override this method and use it to handle thesetransitions.
Presenting Storyboard View Controllers Programmatically
Although the storyboard runtime usually handles transitions between view controllers, you can also triggersegues programmatically from your code. You might do so when it is not possible to set up the segue entirelyin Interface Builder—for example, when doing so involves using accelerometer events to trigger the transition.There are several options for transitioning to a new view controller:
If a storyboard file contains an existing segue between the current view controller and the destinationview controller (perhaps triggered by some other control in the view controller), you can trigger that segueprogrammatically using the performSegueWithIdentifier:sender:method ofUIViewController.
If there is no segue between the view controllers but the destination view controller is defined in thestoryboard file, first load the view controller programmatically using theinstantiateViewControllerWithIdentifier:method of UIStoryboard. Then present the viewcontroller using any of the existing programmatic means, such as by pushing it on a navigation stack.
If the destination view controller is not in the storyboard file, create it programmatically and present it asdescribed inView Controller Programming Guide for iOS.

●
●
●

iOS 5.0
Newsstand Support
Newsstand Support
Newsstand provides a central place for users to read magazines and newspapers. Publishers who want todeliver their magazine and newspaper content through Newsstand can create their own iOS apps using theNewsstand Kit framework (NewsstandKit.framework), although doing so is not required. A big advantageof the Newsstand Kit framework, however, is that you can use it to initiate background downloads of newmagazine and newspaper issues. After you start a download, the system handles the download operation andnotifies your app when the new content is available.
Unlike other iOS apps, Newsstand apps appears only in Newsstand itself, not in a user’s Home screen. Andinstead of displaying an app icon, the app typically displays the cover of their most recent issue, with someadditional adornments provided by Newsstand. When the user taps that cover art, your app launches normallyto present the current issue or any back issues that were downloaded and are still available.
In addition to your server providing content for each new issue, it should also provide cover art to present inNewsstand when that issue is available. This cover art is displayed in place of the app’s default icon, which isspecified by the Newsstand-specific icons in the CFBundleIconskey of your app’s Info.plistfile. Coverart gives users a more visual cue that a new issue is available. Your app can also add a badge to new issues.

iOS 5.0
AirPlay Improvements
AirPlay Improvements
AirPlay lets users stream audio and video from an iOS-based device to AirPlay–enabled devices such as televisionsand audio systems. In iOS 5, developers can now use AirPlay to present app content on a nearby Apple TV 2.Users can now mirror the content of an iPad 2 to an Apple TV using AirPlay for any app. And developers whowant to display different content (instead of mirroring) can assign a new window object to anyUIScreenobjects connected to an iPad 2 via AirPlay.
In addition, you can now take advantage of AirPlay in the following ways:
Apps that use AV Foundation can now use theAVPlayerclass to stream audio and video content overAirPlay; seeAV Foundation Framework Reference.
The Media Player framework includes support for displaying “Now Playing” information in several locations,including as part of the content delivered over AirPlay; seeMPNowPlayingInfoCenter Class Reference.
The UIWebViewclass now supports the presentation of multimedia content over AirPlay. This support isenabled by default, but you can opt out of it if you want to.
Note:IniOS5,AirPlayisenabledbydefaultforallobjectsthatsupportit.Ifyoudonotwantyourapp’s content to be playable over AirPlay, you must opt out explicitly.
New Frameworks
In iOS 5.0, there are several new frameworks you should investigate.
GLKit Framework
The GLKit framework (GLKit.framework) contains a set of Objective-C based utility classes that simplify theeffort required to create an OpenGL ES 2.0 app. GLKit provides support for four key areas of app development:
The GLKViewandGLKViewControllerclasses provide a standard implementation of an OpenGLES–enabled view and associated rendering loop. The view manages the underlying framebuffer object onbehalf of the app; your app just draws to it.

●
●
●

●

iOS 5.0
New Frameworks
The GLKit framework provides implementations of vector, matrix, and quaternions as well as a matrix stackoperation to provide the same functionality found in OpenGL ES 1.1.
The GLKBaseEffect,GLKSkyboxEffect, andGLKReflectionMapEffectclasses provide configurablegraphics shaders that implement commonly used graphics operations. In particular, theGLKBaseEffectclass implements the lighting and material model found in the OpenGL ES 1.1 specification, simplifyingthe effort required to migrate an app from OpenGL ES 1.1 to OpenGL ES 2.0.
For information about the classes of the GLKit framework, seeGLKit Framework Reference.
Core Image Framework
The Core Image framework (CoreImage.framework) provides a powerful set of built-in filters for manipulatingvideo and still images. You can use the built-in filters for everything from simple operations (like touching upand correcting photos) to more advanced operations (like face and feature detection). The advantage of usingthese filters is that they operate in a nondestructive manner so that your original images are never changeddirectly. In addition, Core Image takes advantage of the available CPU and GPU processing power to ensurethat operations are fast and efficient.
The CIImageclass provides access to a standard set of filters that you can use to improve the quality of aphotograph. To create other types of filters, you can create and configure aCIFilterobject for the appropriatefilter type.
For information about the classes and filters of the Core Image framework, seeCore Image Reference Collection.
The Twitter framework (Twitter.framework) provides support for sending Twitter requests on behalf of theuser and for composing and sending tweets. For requests, the framework handles the user authentication partof the request for you and provides a template for creating the HTTP portion of the request. (Refer to theTwitter API for populating the content of the request.) The composition of tweets is accomplished using theTWTweetComposeViewControllerclass, which is a view controller that you post with your proposed tweetcontent. This class gives the user a chance to edit or modify the tweet before sending it.
Users control whether an app is allowed to communicate with Twitter on their behalf using Settings. TheTwitter framework also works in conjunction with the Accounts framework (Accounts.framework) to accessthe user’s account.

●
●
●

iOS 5.0
App Design-Level Improvements
Accounts Framework
The Accounts framework (Accounts.framework) provides a single sign-on model for certain user accounts.Single sign-on improves the user experience, because apps no longer need to prompt a user separately forlogin information related to an account. It also simplifies the development model for you by managing theaccount authorization process for your app. In iOS 5.0, apps can use this framework in conjunction with theTwitter framework to access a user’s Twitter account.
Generic Security Services Framework
The Generic Security Services framework (GSS.framework) provides a standard set of security-related servicesto iOS apps. The basic interfaces of this framework are specified in IETFRFC 2743andRFC 4401. In addition tooffering the standard interfaces, iOS includes some additions for managing credentials that are not specifiedby the standard but that are required by many apps.
For information about the interfaces of the GSS framework, see the header files.
Core Bluetooth
The Core Bluetooth framework (CoreBluetooth.framework) allows developers to interact specifically withBluetooth Low-Energy ("LE") accessories. The Objective-C interfaces of this framework allow you to scan for LEaccessories, connect and disconnect to ones you find, read and write attributes within a service, register forservice and attribute change notifications, and much more.
App Design-Level Improvements
The following sections describe new capabilities that you can incorporate into the model, view, and controllerlayers of your app.

iOS 5.0
App Design-Level Improvements
Document Support
Cocoa Touch now includes aUIDocumentclass for managing the data associated with user documents. If youare implementing a document-based app, this class reduces the amount of work you must do to manage yourdocument data. In addition to providing a container for all of your document-related data, theUIDocumentclass provides built-in support for a number of features:
Asynchronous reading and writing of data on a background queue, allowing your app to remain responsiveto users while reading and writing operations occur.
Support for coordinated reading and writing of documents, which is required for documents in iCloudstorage.
Safe saving of document data by writing data first to a temporary file and then replacing the currentdocument file with it.
Support for resolving conflicts between different versions of your document if a conflict occurs.
Automatic saving of document data at opportune moments.
Support for flat file and package file representations on disk.
For apps that use Core Data to manage their content, there is also aUIManagedDocumentsubclass tomanage interactions with documents in the database.
If you are implementing an app that supports iCloud storage, the use of document objects makes the job ofstoring files in iCloud much easier. Document objects are file presenters and handle many of iCloud-relatednotifications that you might otherwise have to handle yourself. For more information about supporting iCloudstorage, see“iCloud Storage APIs”(page 39).
For information about the  UIDocumentclass, seeUIDocument Class Reference. For information about theUIManagedDocumentclass, see UIManagedDocument Class Reference.
Data Protection Improvements
Introduced in iOS 4.0, data protection lets you store app and user data files on disk in an encrypted format sothat they can be accessed only when a user’s device is unlocked. In iOS 5.0, you now have more flexibilityregarding when your app can access protected files.
Using the NSFileProtectionCompleteUnlessOpenoption, your app can access a file while the deviceis unlocked and, if you keep the file open, continue to access that file after the user locks the device.
Using the NSFileProtectionCompleteUntilFirstUserAuthenticationoption, your app cannotaccess the file while the device is booting or until the user unlocks the device. After the user unlocks thedevice for the first time, you can access the file even if the user subsequently locks the device again.

●
●
●
●
●
●
●

●
●

iOS 5.0
App Design-Level Improvements
You should protect files as soon as possible after creating them. For information about how to protect files,seeiOS App Programming Guide.
Custom Appearance for UIKit Controls
You can now customize the appearance of many UIKit views and controls to give your app a unique look andfeel. For example, you might use these customizations to make the standard system controls match the brandingfor the rest of your app.
UIKit supports the following customizations:
You can set the tint color, background image, and title position properties (among other) on a wide varietyof objects, including toolbars, navigation bars, search bars, buttons, sliders, and some other controls.
You can set attributes of some objects directly, or you can set the default attributes to use for a class usingan appearance proxy.
An appearance proxy is an object you use to modify the default appearance of visual objects such as viewsand bar items. Classes that adopt theUIAppearanceprotocol support the use of an appearance proxy.To modify the default appearance of such a class, retrieve its proxy object using theappearanceclassmethod and call the returned object’s methods to set new default values. A proxy object implementsthose methods and properties from its proxied class that are tagged with theUI_APPEARANCE_SELECTORmacro. For example, you can use a proxy object to change the default tint color (through theprogressTintColorortrackTintColorproperties) of theUIProgressViewclass.
If you want to set a different default appearance based on how a given object is used in your app, youcan do so using the proxy object returned by theappearanceWhenContainedIn:method instead. Forexample, you use this proxy object to set specific default values for a button only when it is containedinside a navigation bar.
Any changes you make with a proxy object are applied, at view layout time, to all instances of the classthat exist or that are subsequently created. However, you can still override the proxy defaults later usingthe methods and properties of a given instance.
For information about the methods for customizing the appearance of a class, see the description of that classinUIKit Framework Reference.
Container View Controller Support
The UIViewControllerclass now allows you to define your own custom container view controllers andpresent content in new and interesting ways. Examples of existing container view controllers includeUINavigationController,UITabBarController, andUISplitViewController. These view controllers

●
●

iOS 5.0
Xcode Tools
mix custom content with content provided by one or more separate view controller objects to create a uniquepresentation for app content. Container view controllers act as a parent for their contained view controllers,forwarding important messages about rotations and other relevant events to their children.
For more information about view controllers and the methods you need to implement for container viewcontrollers, seeUIViewController Class Reference.
Settings
Apps that deliver custom preferences can now use a new radio group element. This element is similar to themultivalue element for selecting one item from a list of choices. The difference is that the radio group elementdisplays its choices inline with your preferences instead of on a separate page.
For more information about displaying app preferences using the Settings app, see “App-Related Resources”iniOS App Programming Guide. For information about the property-list keys you use to build your Settingsbundle, seeSettings Application Schema Reference.
Xcode Tools
The following sections describe the improvements to the Xcode tools and the support for developing iOS apps.For detailed information about the features available in Xcode 4.2, seeWhat's New in Xcode.
Xcode Improvements
Xcode 4.2 adds support for many features that are available in iOS 5.0.
The LLVM compiler supports Automatic Reference Counting (ARC), and Xcode includes a menu item toconvert targets to use ARC. (For more information about ARC and about how to use it in your apps, see“Automatic Reference Counting” (page 41).)
In iOS Simulator, you can now simulate different locations for apps using the Core Location framework.
You can download your app data from an iOS device and automatically restore that data when debuggingor testing in iOS simulator or on a device.
OpenGL ES Debugging
The debugging experience in Xcode has been updated to include a new workflow for debugging OpenGL ESapps. You can now use Xcode to do the following for your OpenGL ES apps:

●
●
●
●

iOS 5.0
Xcode Tools
Introspect OpenGL ES state information and objects such as view textures, shaders, and so on.
Set breakpoints on OpenGL ES errors, set conditional OpenGL ES entry point breakpoints, break on frameboundaries, and so on.
UI Automation Enhancements
The Automation instrument now includes a script editor and the ability to capture (record) actions into yourscript as you perform them on a device. There are also enhancements to the objects that you use in theAutomation instrument to automate UI testing:
The UIATargetobject can now simulate rotate gestures and location changes.
The UIAHostobject supports executing a task from the Instruments app itself.
The UIAElementobject can now simulate a rotate gesture centered on the element.
Several functions that were previously available only inUIAWindowandUIAPopoverwere moved toUIAElementbecause they are common to all element objects.
The UIAKeyboardobject now supports performing a sequence of keyboard taps to simulate the typingof a string.
For information about the enhancements to the Automation instrument, seeInstruments New Features UserGuide. For information about the JavaScript objects and commands that you use in your scripts, seeUIAutomation JavaScript Reference.
Instruments
The Instruments app in Xcode 4.2 adds several new instruments for iOS developers:
System Trace for iOS—Uses several instruments to profile aspects of Mac OS X or iOS that could be affectingapp performance, such as system calls, thread scheduling, and VM operations.
Network Connections instrument—Inspect how your app is using TCP/IP and UDP/IP connections. Withthis instrument it is possible to see how much data is flowing through each connection and for each app.You can also use it to display interesting statistics, such as round trip times and retransmission requestinformation.
Network Activity (located in Energy Diagnostics)—Helps bridge the gap between networking (cellular andWiFi) and energy usage. You use it to display device-wide data flow through each network interfacealongside energy usage level data that is taken directly from the battery.
For information about using these new instruments, seeInstruments New Features User Guide

●
●

●
●
●
●
●

●
●
●

iOS 5.0
In addition to the items discussed in the preceding sections, the following frameworks have additionalenhancements. For a complete list of new interfaces, seeiOS 5.0 API Diffs .
UIKit
The UIKit framework (UIKit.framework) includes the following enhancements:
The UIViewControllerclass can now be used to create custom container view controllers; see“ContainerView Controller Support”(page 50).
The UIKit framework provides support for loading and using storyboards; see“Storyboards”(page 43).Bars and bar button items can now be tinted and customized for your app; see“Custom Appearance for
UIKit Controls”(page 50). The UIPageViewControllerclass is a new container view controller for creating page-turn transitions
between view controllers.
The UIReferenceLibraryViewControllerclass adds support for presenting a custom dictionaryservice to the user.
The UIImagePickerControllerclass supports new options for specifying the quality of video recordings.TheUIStepperclass is a new control for incrementing a floating-point value value up or down within a
configurable range. View-based animations now support cross-dissolve, flip-from-top, and flip-from-bottom animations; see
UIView Class Reference. The UIApplicationclass now reports the language directionality of the running app.
The UITableViewclass adds support for automatic row animations, moving rows and sections,multiselection, and copy and paste behaviors for cells.
The UIScreenclass lets you specify overscan compensation behaviors for video delivered over AirPlayor through an attached HDMI cable. You can also programmatically set a screen’s brightness.
The UIScrollViewclass now exposes its gesture recognizers so that you can configure them moreprecisely for your app.
The UISegmentedControlclass now supports proportional segment widths. The UIAlertViewclass now supports password-style text entry and special configurations for entering
text securely. The UIColorclass includes support for Core Image and new methods to retrieve individual color values.
The UIImageclass includes support for Core Image, support for stretching an image by tiling part of itscontent, and support for looping animations.

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

iOS 5.0
The UIAccessibilityprotocol includes new interfaces that define the activation point within an elementand indicate whether an element is modal or contains hidden elements. There are also new notificationsthat inform you of changes in system-provided accessibility features, such as zoom, audio status, andclosed captioning.
The UIAccessibilityReadingContentprotocol allows you to provide a continuous, page-turningreading experience to VoiceOver users.
The UIAccessibilityIdentificationprotocol allows you to uniquely identify elements in your appso that you can refer to them in automation scripts.
The UIWebViewclass automatically supports the presentation of multimedia content over AirPlay. Youcan opt out of this behavior by changing the value in themediaPlaybackAllowsAirPlayproperty ofthe class. This class also exposes ascrollViewproperty so that you can access the scrolling propertiesof your web interfaces.
For information about the classes of the UIKit framework, seeUIKit Framework Reference.
OpenGL ES
OpenGL ES (OpenGLES.framework) now includes the following new extensions:
The EXT_debug_labelandEXT_debug_markerextensions allow you to annotate your OpenGL ES drawingcode with information specific to your app. The OpenGL ES Performance Detective, the OpenGL ESDebugger, and the OpenGL ES Analyzer tools provided by Xcode all take advantage of these annotations.
The EXT_color_buffer_half_floatextension allows 16-bit floating point formats to be specified for a framebuffer's color renderbuffer.
The EXT_occlusion_query_booleanextension allows your app to determine whether any pixels would bedrawn by a primitive or by a group of primitives.
The EXT_shadow_samplersextension provides support for shadow maps. The EXT_texture_rgextension adds one-component and two-component texture formats suitable for use
in programmable shaders. As always, check for the existence of an extension before using it in your app.

●
●
●
●
●

●
●
●
●
●
●

iOS 5.0
OpenAL
The OpenAL framework (OpenAL.framework) has two significant extensions:
You can get notifications about source state changes and changes regarding the number of audio buffersthat have been processed.
The Apple Spatial Audio extension in iOS 5.0 adds three audio effects that are especially useful for games:reverberation, obstruction effects, and occlusion effects.
Message UI
The Message UI framework (MessageUI.framework) adds a new notification for tracking changes to thedevice’s ability to send text messages. For information about the interfaces of the Message UI framework, seeMessage UI Framework Reference.
Media Player
The Media Player framework (MediaPlayer.framework) includes the following enhancements:
There is now support for displaying “Now Playing” information in the lock screen and multitasking controls.This information can also be displayed on an Apple TV and with content delivered via AirPlay.
You can detect whether video is being streamed to an AirPlay device using theairPlayVideoActiveproperty of theMPMoviePlayerControllerclass.
Apps can now use the framework to play content from iTunes University. For information about the classes in the Media Player framework, see Media Player Framework Reference.
Map Kit
The Map Kit framework (MapKit.framework) supports the ability to use heading data to rotate a map basedon the user’s current orientation. As you can with the Maps app, you can configure your map view to scrollthe map according to the user’s current location. For example, a walking tour app might use this to show theuser their current location on the tour.
For information on the interfaces you use to implement map scrolling and rotation, seeMap Kit FrameworkReference.

●
●

●
●

●

iOS 5.0
Note:IfyouarecurrentlyusingMapKitforgeocoding,youshouldswitchtousingtheCoreLocationframework for that feature; see“Core Location”(page 58).
Game Kit
The Game Kit framework (GameKit.framework) and Game Center now have the following features:
The GKTurnBasedMatchclass provides support for turn-based gaming, which allows games to createpersistent matches whose state is stored in iCloud. Your game manages the state information for thematch and determines which player must act to advance the state of the match.
The GKNotificationBannerclass implements a customizable banner similar to the banner shown toplayers when they log in to Game Center. Your game may use this banner to display messages to theplayer.
When your game reports an achievement, it can automatically display a banner to the player using theGKAchievementclass.
A GKMatchmakerViewControllerobject can now add players to an existing match in addition tocreating a new match.
The GKMatchDelegateprotocol now includes a method to reconnect devices when a two-player matchis disconnected.
For information about the classes of the Game Kit framework, seeGame Kit Framework Reference.
Foundation
The Foundation framework (Foundation.framework) includes the following enhancements:

●
●
●
●
●
●

iOS 5.0
The NSFileManagerclass includes new methods for moving a file to a user’s iCloud storage. The new NSFileCoordinatorclass andNSFilePresenterprotocol implement now locking support
and notifications when manipulating documents in iCloud. The new NSFileVersionclass reports and manages conflicts between different versions of a file in iCloud.TheNSURLclass includes new methods and constants to support syncing items to a user’s iCloud storage.
The new NSJSONSerializationclass is a new class that supports back-and-forth conversions betweenJSON dataand Foundation types.
The new NSLinguisticTaggerclass is a new class lets you break down a sentence into its grammaticalcomponents, allowing the determination of nouns, verbs, adverbs, and so on. This tagging works fully forEnglish and the class also provides a method to find out what capabilities are available for other languages.
This framework now includes theNSFileWrapperclass for managing file packages—that is, filesimplemented as an opaque directory.
The new NSOrderedSetcollection class offers the semantics of sets, whereby each element occurs atmost once in the collection, but where elements are in a specific order.
Most delegate methods are now declared using formal protocols instead of as categories onNSObject.For information about the classes of the Foundation framework, seeFoundation Framework Reference.
External Accessory
Apps that use the External Accessory framework to communicate with external accessories can now ask to bewoken up if the app is suspended when its accessory delivers new data. Including theUIBackgroundModeskey with theexternal-accessoryvalue in your app’sInfo.plistfile keeps your accessory sessions openeven when your app is suspended. (Prior to iOS 5, these sessions were closed automatically at suspend time.)When new data arrives for a given session, a suspended app is woken up and given time to process the newdata. This type of behavior is designed for apps that work with heart-rate monitors and other types of accessoriesthat need to deliver data at regular intervals.
Event Kit and Event Kit UI
The Event Kit framework (EventKit.framework) includes the following enhancements:

●
●
●
●
●
●
●
●
●

●

iOS 5.0
The class hierarchy has been restructured. There is now a common base class calledEKObjectand portionsof the EKEventclass have been moved into a new base class calledEKCalendarItem.
With the EKEventStoreclass, you can now create and delete calendars programmatically, fetch calendarsbased on their identifier, save and remove events in batches, and trigger a programmatic refresh of calendardata.
The new EKSourceclass represents the source for creating new calendars and events. The EKCalendarclass now provides access to a calendar’s UUID, source, and other attributes.
The Event Kit UI framework (EventKitUI.framework) now includes the EKCalendarChooserclass, whichprovides a standard way for selecting from the user’s iCal calendars.
For information about the classes of the Event Kit framework, seeEvent Kit Framework Reference. For informationabout the classes of the Event Kit UI framework, seeEvent Kit UI Framework Reference.
Core Motion
The Core Motion framework (CoreMotion.framework) now supports reporting heading information andmagnetometer data for devices that have the corresponding hardware.
For information about the classes of the Core Motion framework, seeCore Motion Framework Reference.
Core Location
The Core Location framework (CoreLocation.framework) now includes support for both forward andreverse geocoding location data. This support allows you to convert back and forth between a set of mapcoordinates and information about the street, city, country (and so on) at that coordinate.
For information about the classes of the Core Location framework, seeCore Location Framework Reference.
Core Graphics
The Core Graphics framework (CoreGraphics.framework) includes some new interfaces to support thecreation of paths. Specifically, there are new interfaces for creating paths with an ellipse or rectangle and foradding arcs to existing paths.
Core Data
The Core Data framework includes the following enhancements:

●
●
●
●

iOS 5.0
Core Data provides integration with the iOS document architecture and iCloud storage. TheUIManagedDocumentclass is a concrete subclass ofUIDocumentthat uses a Core Data persistent storefor document data storage.
For apps built for iOS 5.0 or later, persistent stores now store data by default in an encrypted format ondisk. The default protection level prevents access to the data until after the user unlocks the device forthe first time. You can change the protection level by assigning a custom value to theNSPersistentStoreFileProtectionKeykey when configuring your persistent stores. For additionalinformation about the data protection that are new in iOS 5.0, see“Data Protection Improvements”(page49).
Core Data formalizes the concurrency model for theNSManagedObjectContextclass with new options.When you create a context, you can specify the concurrency pattern to use with it: thread confinement,a private dispatch queue, or the main dispatch queue. TheNSConfinementConcurrencyTypeoptionprovides the same behavior that was present on versions of iOS prior to 5.0 and is the default. Whensending messages to a context created with a queue association, you must use theperformBlock:orperformBlockAndWait:method if your code is not already executing on that queue (for the main queuetype) or within the scope of aperformBlock...invocation (for the private queue type). Within theblocks passed to those methods, you can use the methods ofNSManagedObjectContextfreely. TheperformBlockAndWait:method supports API reentrancy. TheperformBlock:method includes anautorelease pool and calls theprocessPendingChangesmethod upon completion.
You can create nested managed object contexts, in which the parent object store of a context is anothermanaged object context rather than the persistent store coordinator. This means that fetch and saveoperations are mediated by the parent context instead of by a coordinator. This pattern has a number ofusage scenarios, including performing background operations on a second thread or queue and managingdiscardable edits, such as in an inspector window or view
Nested contexts make it more important than ever that you adopt the “pass the baton” approach ofaccessing a context (by passing a context from one view controller to the next) rather than retrieving itdirectly from the app delegate.
Managed objects support two significant new features: ordered relationships, and external storage forattribute values. If you specify that the value of a managed object attribute may be stored as an externalrecord, Core Data heuristically decides on a per-value basis whether it should save the data directly in thedatabase or store a URI to a separate file that it manages for you.
There are two new classes,NSIncrementalStoreandNSIncrementalStoreNode, that you can useto implement support for nonatomic persistent stores. The store does not have to be a relationaldatabase—for example, you could use a web service as the back end.
For more details about the new features in Core Data, seeCore Data Release Notes for OS X v10.7 and iOS 5.0.

●
●
●

●

●
●

iOS 5.0
Core Audio
The Core Audio family of frameworks includes the following changes in iOS 5.0:
Audio-session routing information is now specified using dictionary keys. There are also new modes formanaging your app’s audio behavior:
Voice chat mode optimizes the system for two-way voice conversation. Video recording mode configures the device for video capture. Measurement mode disables automatic compression and limiting for audio input.Default mode provides iOS 4.3.3 behavior.

●
●
●
●
●
●
●
For information about the audio technologies available in iOS, seeMultimedia Programming Guide. Forinformation about the new audio units, seeAudio Unit Component Services Reference.
AV Foundation
The AV Foundation framework includes the following enhancements:
There is automatic support for playing audio and video content over AirPlay. Apps can opt out oftransmitting video over AirPlay using theallowsAirPlayVideoproperty of the AVPlayerclass.
New properties on the  AVPlayerItemclass indicate whether the item supports fast-forwarding orrewinding of the content.
For information about the classes of the AV Foundation framework, seeAV Foundation Framework Reference.

●
●

●
●
●
●

Core Audio adds seven new audio units for handling advanced audio processing features in your app,such as reverb, adjustable equalization, and time compression and stretching. The new Sampler unit letsyou create music instruments, for which you can provide your own sounds. The new AUFilePlayer unit letsyou play sound files and feed them directly to other audio units.
The 3D Mixer audio unit is enhanced in iOS 5.0 to provide reverb and other effects useful in game audio.
You can automate audio unit parameters in an audio processing graph, which lets you build a music mixerthat remembers fader positions and changes.
You can now use the advanced features of Apple Core Audio Format files in iOS. For example, you mightcreate new voices for the Sampler audio unit.
There is now programmatic support for adjusting the audio input gain. Core Audio now supports 32-bit floating-point audio data for apps that need to provide high quality audio.

iOS 5.0
Assets Library
The Assets Library framework includes the following enhancements:
Support for accessing photo streams Support for creating new albums in the user’s photo librarySupport for adding assets to albums The ability to get an aspect ratio thumbnail for an assetThe ability to modify saved assets
For information about the classes of the Assets Library framework, seeAssets Library Framework Reference.
The Address Book framework adds support for importing and exporting vCard data. It also adds new keys toassociate social network affiliations with a user record.
Security
The Security framework (Security.framework) now includes the Secure Transport interfaces, which areApple’s implementation of the SSL/TLS protocols. You can use these interfaces to configure and manage SSLsessions, manage ciphers, and manage certificates.
For information about the Secure Transport interfaces, see theSecureTransport.hheader file of the Securityframework.

●
●
●
●
●

iOS 4.3
This article summarizes the key developer-related features introduced in iOS 4.3. This version of the operatingsystem runs on all iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.
For the latest updates and information, you should also seeiOS 4.3 Release Notes. For the complete list of newAPIs added in iOS 4.3, seeiOS 4.3 API Diffs.
AirPlay Video Support
Support for playing video using AirPlay is included in theMPMoviePlayerControllerclass. This supportallows you to play video-based content on AirPlay–enabled hardware such as Apple TV. When theallowsAirPlayproperty of an active MPMoviePlayerControllerobject is set toYESand the device is inrange of AirPlay–enabled hardware, the movie player presents the user with a control for sending the videoto that hardware. (That property is set toNOby default.) Supported formats include:
H.264 video with AAC audio HTTP streaming, both live and on demandprogressive download content local content
For web-based content, you can enable AirPlay Video in the QuickTime Plug-in or HTML5 video element asfollows:
airplay="allow"

airplay="deny"(Default)
For example: <embed src="movie.mov" width="320" height="240" airplay="allow">
x-webkit-airplay="allow"x-webkit-airplay="deny"(Default)

●
●
●
●

● ●

● ●

QTPlug-in:

●

HTML5 video element:

●

iOS 4.3
Framework Enhancements
For example: <video controls width="640" height="368" x-webkit-airplay="allow"src="content/side_with_the_seeds.mov"> </video>
Framework Enhancements
The following sections highlight the significant changes to frameworks and technologies in iOS 4.3. For acomplete list of all new interfaces available in the system, seeiOS 4.3 API Diffs .
AV Foundation
The AV Foundation framework includes the following enhancements:
The AV Foundation framework added theAVPlayerItem,AVPlayerItemAccessLogEvent, andAVPlayerItemErrorLogEventclasses for tracking network playback statistics.
Core Audio Frameworks
The Audio Unit and Audio Toolbox frameworks include the following enhancements:
The AudioUnitParameterHistoryInfostruct (in the Audio Unit framework) along with supportingaudio unit properties adds the ability to track and use parameter automation history.
The ExtendedAudioFormatInfostruct (in the Audio Toolbox framework) lets you specify which codecto use when accessing thekAudioFormatProperty_FormatListproperty.
The kAFInfoDictionary_SourceBitDepthdictionary key and thekAudioFilePropertySourceBitDepthproperty (in the Audio Toolbox framework) provide access tothe bit depth of an audio stream.
The kAudioConverterErr_NoHardwarePermissionresult code (in the Audio Toolbox framework)indicates that a request to create a new audio converter object cannot be satisfied because the applicationdoes not have permission to use the requested hardware codec.
For information about the functions and types of the Audio Unit framework, seeAudio Unit Framework Reference.For information about the functions and types of the Audio Toolbox framework, seeAudio Toolbox FrameworkReference.

●

●

●
●
●
●

iOS 4.3
Framework Enhancements
The ADInterstitialAdclass is controller that you can use to present full-screen banners in your content.You present these banners in an existing view or as part of a transition from one page of content to another.For example, you might use this object to incorporate full-page ads into a page-based magazine layout.
Media Player
The Media Player framework includes the following enhancements:
The MPMoviePlayerControllerclass supports playback of video content using AirPlay; see“AirPlayVideo Support”(page 62).
The MPMovieAccessLog,MPMovieErrorLog,MPMovieAccessLogEvent, andMPMovieErrorLogEventclasses allow you to track network playback statistics.
UIKit
The UIViewControllerclass added thedisablesAutomaticKeyboardDismissalmethod, which youcan use to override the default input view dismissal behavior.

●
●

●

iOS 4.2
This article summarizes the key developer-related features introduced in iOS 4.2. This version of the operatingsystem runs on all iOS-based devices. In addition to describing the key new features, this article lists thedocuments that describe those features in more detail.
For the latest updates and information, you should also seeiOS 4.2 Release Notes. For the complete list of newAPIs added in iOS 4.2, seeiOS 4.2 API Diffs.
Printing
iOS now incorporates support for wireless printing from iPhone and iPad applications. For the most part, theobjects provided by UIKit do all of the heavy lifting associated with printing. They manage the printing interfaces,work with your application to render the printable content, and handle the scheduling and execution of printjobs on the printer.
Print jobs submitted by your application are handed off to the printing system, which manages the actualprinting process. Print jobs from all applications on a device are queued and printed on a first-come, first-servedbasis. Users can get the status of print jobs from the Print Center application and can even use that applicationto cancel print jobs. All other aspects of printing are handled for you automatically by the system.
Note:Wireless printing is available only on devices that support multitasking. You can use theUIPrintInteractionControllerobject to detect whether printing is available in your application.
To simplify the printing process, UIKit provides automatic support for some types of content to make printingeasier. Specifically, applications provide printable content in one of three ways:
An application can hand images or PDF content directly to UIKit and let it manage the printing of thoseitems.
An application can use print formatter objects to lay out specific types of content over multiple pages.UIKit provides print formatters for plain text, HTML text, and some system views (web views, text views,and map views).
An application can choose to render the content itself using a print page renderer object. This option givesyou the most control over your printed content but also lets you use print formatters to assist with thelayout of parts of your content.

●
●
●

iOS 4.2
AirPlay
For information about how to incorporate the new printing support into your applications, see “Printing” inDrawing and Printing Guide for iOS.
AirPlay
AirPlay is a technology that lets your application stream audio to Apple TV and to third-party AirPlay speakersand receivers. AirPlay support is built in to the AV Foundation framework and the Core Audio family offrameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlaydistribution. Once the user chooses to play your audio using AirPlay, it is routed automatically by the system.
For information on how to play audio content, seeMultimedia Programming Guide.
Core MIDI
The Core MIDI framework (CoreMIDI.framework) provides a standard way to communicate with MIDI devices,including hardware keyboards and synthesizers. You use this framework to send and receive MIDI messagesand to interact with MIDI peripherals connected to an iOS-based device using the dock connector or network.
Applications that link against iOS SDK 4.2 or later can now take advantage of new support for determining theavailability of Objective-C classes. System frameworks now tag their classes with availability information thatthe compiler can use to link weakly to those classes as needed. This new tagging mechanism simplifies thecode you need to use to do runtime checking for the availability of the class. Whereas previously, you neededto use theNSClassFromStringfunction to determine whether a class was present, now you can simplycheck for the existence the class directly using code similar to the following:
if ([UIPrintInteractionController class])
{

// Create an instance of the class and use it.
}

else{
// The print interaction controller is not available.

iOS 4.2
Framework Enhancements
}
In order to use this feature, you must do the following:
Build your project using LLVM and Clang. (The standalone GCC compiler does not currently support thisfeature.)
Set your project’s deployment target to iOS 3.1 or later.
Change the linking option for each framework you want to link weakly. To do this, open an inspector foryour application target and go to the inspector’s General tab to view the list of frameworks and librarieslinked against the target. For frameworks you want to link weakly, change the value in the Type columnfrom Required to Weak.
If the deployment target for your application is set to a version of iOS that does not contain a givenframework (because it was introduced in a later version), set the link type of that framework to Weak. Formost other frameworks, you should leave the link type set to Required.
For information about how to perform runtime availability checks for classes and methods, seeSDK CompatibilityGuide.
Framework Enhancements
The following sections highlight the significant changes to frameworks and technologies in iOS 4.2. For acomplete list of all new interfaces available in the system, seeiOS 4.2 API Diffs .
Core Location
The Core Location framework includes new interfaces for determining whether a device is authorized to uselocation services and for detecting changes in the current authorization status. For more information abouthow to use Core Location in your application, see Location and Maps Programming Guide.
Game Kit
The Game Kit framework includes a newGKFriendRequestComposeViewControllerclass, which you canpresent from your application and use to invite friends to play a game. For more information about how touse Game Kit in your application, seeGame Center Programming Guide.

●
●
●

iOS 4.2
Framework Enhancements
Media Player
The Media Player framework includes the following enhancements:
The interface presented by theMPVolumeViewclass now includes a control for routing audio content toAirPlay–enabled devices.
The MPMediaItemandMPMediaItemCollectionclasses now descend from a common ancestor class:MPMediaEntity. This change in hierarchy allows you to create collections that include both items andother collections.
Persistent IDs for more collection types are now available. Media queries now provide more information about how media items are grouped together.
UIKit
The UIKit framework includes the following enhancements
New accessibility constants allow “scroll by page” capabilities using VoiceOver. New classes to support printing; see “Printing”(page 65) The UIDeviceclass now provides theplayInputClickmethod for playing the input-click sound directly.
Application delegates can now use theapplication:openURL:sourceApplication:annotation:method to receive information about URLs that are opened while the application is running in thebackground.
The UITextInputModeclass now exposes the language in use for inputting text. The UIDocumentInteractionControllerclass supports printing with the help of its delegate object.

●
●
●
●

●
●
●
●
●
●

iOS 4.1
This article summarizes the developer-related features introduced in iOS 4.1. This version of the operatingsystem runs on iPhone and iPod touch only and does not run on iPad. In addition to describing the new features,this article lists the documents that describe those features in more detail.
For the latest updates and information, you should also seeiOS 4.1 Release Notes. For the list of API differencesbetween the iOS 4.1 and earlier versions of iOS, seeiOS 4.1 API Diffs.
Game Center
Game Center is an extension to the Game Kit framework that provides support for the following features:
Aliases allow users to create their own online persona. Users log in to Game Center and interact with otherplayers anonymously through their alias. Players can set status messages as well as mark specific peopleas their friends.
Leaderboards allow your application to post user scores to Game Center and retrieve them later. Youmight use this feature to show the best scores among all users of your application.
Matchmaking allows you to create multiplayer games by connecting players who are logged into GameCenter. Players do not have to be local to each other to join a multiplayer game.
Achievements allows you to record the progress a player has made in your game. The preceding features all contribute towards the experience users see in the Game Center application. For
information about the classes of the Game Kit framework, seeGame Kit Framework Reference.
Framework Enhancements
The following existing frameworks and technologies include additional incremental changes. For a completelist of new interfaces, seeiOS 4.1 API Diffs .

●
●
●

●

iOS 4.1
Framework Enhancements
AV Foundation
The AV Foundation framework includes the following enhancements:
A new AVQueuePlayerclass for playing a sequence ofAVPlayerItemobjects. A new AVAssetReaderclass for reading samples from media files. A new AVAssetWriterclass for writing samples to a data file and optionally compressing them.
Assets Library
The Assets Library framework includes new methods to save images to a user’s photo album. These newmethods are declared in theALAssetsLibraryclass.
Core Text
The Core Text framework includes new functions for managing fonts. For more information about the functionsavailable in the Core Text framework, seeCore Text Reference Collection.
System Configuration
The System Configuration framework contains new interfaces for identifying captive networks. For moreinformation about the functions available in the System Configuration framework, seeSystem ConfigurationFramework Reference.
UIKit
The UIKit framework includes the following enhancements:
A decimal keyboard type that you can use for text entry. You can specify this keyboard type using theUIKeyboardTypeDecimalPadconstant.

●
●
●

●
●

iOS 4.0
This article summarizes the developer-related features introduced in iOS 4. This version of the operating systemruns on iPhone and iPod touch only and does not run on iPad. In addition to describing the new features, thisarticle lists the documents that describe those features in more detail.
For the latest updates and information, you should also seeiOS 4.0 Release Notes. For the list of API differencesbetween the iOS 4 and earlier versions of iOS, seeiOS 4.0 API Diffs.
Applications built using iOS SDK 4 or later (and running in iOS 4 and later) are no longer terminated when theuser presses the Home button; instead, they now shift to a background execution context. For many applications,this means that the application enters a suspended state of execution shortly after entering the background.Keeping the application in memory avoids the subsequent launch cycle and allows an application to simplyreactivate itself, which improves the overall user experience. And suspending the application improves overallsystem performance by minimizing power usage and giving more execution time to the foreground application.
Although most applications are suspended shortly after moving to the background, applications that need tocontinue working in the background may do so using one of the following techniques:
An application can request a finite amount of time to complete some important task.
An application can declare itself as supporting specific services that require regular background executiontime.
An application can use local notifications to generate user alerts at designated times, whether or not theapplication is running.
Regardless of whether your application is suspended or continues running in the background, supportingmultitasking does require some additional work on your part. Background applications can still be terminatedunder certain conditions (such as during low-memory conditions), and so applications must be ready to exit

●
●
●

iOS 4.0
Integration Technologies
at any time. This means that many of the tasks you used to perform at quit time must now be performed whenyour application moves to the background. This requires implementing some new methods in your applicationdelegate to respond to application state transitions.
For more information on how to handle the new background state transitions, and for information on how tocontinue running in the background, seeiOS App Programming Guide.
Integration Technologies
The following sections describe the technologies you can use to enhance your application’s user experience.
Local notifications complement the existing push notifications by giving applications an avenue for generatingthe notifications locally instead of relying on an external server. Background applications can use localnotifications as a way to get a user’s attention when important events happen. For example, a navigationapplication running in the background can use local notifications to alert the user when it is time to make aturn. Applications can also schedule the delivery of local notifications for a future date and time and have thosenotifications delivered even if the application is not running.
The advantage of local notifications is that they are independent of your application. Once a notification isscheduled, the system manages the delivery of it. Your application does not even have to be running whenthe notification is delivered.
Event Kit
The Event Kit framework (EventKit.framework) provides an interface for accessing calendar events on auser’s device. You can use this framework to get existing events and add new events to the user’s calendar.Calendar events can include alarms that you can configure with rules for when they should be delivered. Inaddition to using Event Kit for creating new events, you can use the view controllers of the Event Kit UIframework (EventKitUI.framework) to present standard system interfaces for viewing and editing events.
For more information about the classes and methods of these frameworks, seeEvent Kit Framework ReferenceandEvent Kit UI Framework Reference.

iOS 4.0
Integration Technologies
Core Motion
The Core Motion framework (CoreMotion.framework) provides a single set of interfaces for accessing allmotion-based data available on a device. The framework supports accessing both raw and processedaccelerometer data using a new set of block-based interfaces. For devices with a built-in gyroscope, you canretrieve the raw gyro data as well as processed data reflecting the attitude and rotation rates of the device.You can use both the accelerometer and gyro-based data for games or other applications that use motion asinput or as a way to enhance the overall user experience.
For more information about the classes and methods of this framework, see “Event Delivery: The ResponderChain” inEvent Handling Guide for iOS.
Data Protection
Applications that work with sensitive user data can now take advantage of the built-in encryption availableon some devices to protect that data. When your application designates a particular file as protected, thesystem stores that file on-disk in an encrypted format. While the device is locked, the contents of the file areinaccessible to both your application and to any potential intruders. However, when the device is unlockedby the user, a decryption key is created to allow your application to access the file.
Implementing data protection requires you to be considerate in how you create and manage the data youwant to protect. Applications must themselves be designed to secure the data at creation time and to beprepared for changes in access to that data when the user locks and unlocks the device.
Core Telephony
The Core Telephony framework (CoreTelephony.framework) provides interfaces for interacting withphone-based information on devices that have a cellular radio. Applications can use this framework to getinformation about a user’s cellular service provider. Applications interested in cellular call events can also benotified when those events occur.

iOS 4.0
Graphics and Multimedia
Graphics and Multimedia
The following sections describe the new graphics and media-related technologies you can incorporate intoyour applications.
High-Resolution Screen Support
For the most part, applications running on devices with high-resolution screens should work with little or nomodifications. The coordinate values you specify during drawing or when manipulating views are all mappedto a logical coordinate system, which is decoupled from the underlying screen resolution. Any content youdraw is automatically scaled as needed to support high-resolution screens. For vector-based drawing code,the system frameworks automatically use any extra pixels to improve the crispness of your content. And if youuse images in your application, UIKit provides support for loading high-resolution variants of your existingimages automatically.
For detailed information about how to support high-resolution screens, see “Supporting High-ResolutionScreens In Views” inDrawing and Printing Guide for iOS.
Quick Look Framework
The Quick Look framework (QuickLook.framework) provides a direct interface for previewing the contentsof files your application does not support directly. This framework is intended primarily for applications thatdownload files from the network or that otherwise work with files from unknown sources. After obtaining thefile, you use the view controller provided by this framework to display the contents of that file directly in youruser interface.

iOS 4.0
Graphics and Multimedia
AV Foundation
The AV Foundation framework (AVFoundation.framework) is for applications that need to go beyond themusic and movie playback features found in the Media Player framework. Originally introduced in iOS 3.0, thisframework has been expanded in iOS 4 to include significant new capabilities, substantially broadening itsusage beyond basic audio playback and recording capabilities. Specifically, this framework now includes supportfor the following features:
Media asset managementMedia editing Movie capture Movie playback
Track management
Stereophonic panning
Precise synchronization between sounds
An Objective-C interface for determining details about sound files, such as the data format, sample rate,and number of channels
The AV Foundation framework is a single source for recording and playing back audio and video in iOS. Thisframework also provides much more sophisticated support for handling and managing media items.
Assets Library
The Assets Library framework (AssetsLibrary.framework) provides a query-based interface for retrievinga user’s photos and videos. Using this framework, you can access the same assets that are nominally managedby the Photos application, including items in the user’s saved photos album and any photos and videos thatwere imported onto the device. You can also save new photos and videos back to the user’s saved photosalbum.

●
●
●
●
●
●
●
●
●

iOS 4.0
Core Services
Image I/O
The Image I/O framework (ImageIO.framework) provides interfaces for importing and exporting image dataand image metadata. This framework is built on top of the Core Graphics data types and functions and supportsall of the standard image types available in iOS.
Core Media
The Core Media framework (CoreMedia.framework) provides the low-level media types used by AVFoundation. Most applications should never need to use this framework, but it is provided for those fewdevelopers who need more precise control over the creation and presentation of audio and video content.
Core Video
The Core Video framework (CoreVideo.framework) provides buffer and buffer pool support for Core Media.Most applications should never need to use this framework directly.
Core Services
The following sections describe the new lower-level technologies and features you can incorporate into yourapplications.
Block Objects
Block objects are a C-level language construct that you can incorporate into your C and Objective-C code. Ablock object is essentially an anonymous function and the data that goes with that function, something whichin other languages is sometimes called a closureorlambda. Blocks are particularly useful as callbacks or inplaces where you need a way of easily combining both the code to be executed and the associated data.
In iOS, blocks are commonly used in the following scenarios:
As a replacement for delegates and delegate methods As a replacement for callback functions To implement completion handlers for one-time operationsTo facilitate performing a task on all the items in a collection

●
●
●
●

iOS 4.0
Xcode Tools
Together with dispatch queues, to perform asynchronous tasks For an introduction to block objects and how you use them, see A Short Practical Guide to Blocks. For more
information about blocks, seeBlocks Programming Topics.
Grand Central Dispatch
Grand Central Dispatch (GCD) is a BSD-level technology that you use to manage the execution of tasks in yourapplication. GCD combines an asynchronous programming model with a highly optimized core to provide aconvenient (and more efficient) alternative to threading. GCD also provides convenient alternatives for manytypes of low-level tasks, such as reading and writing file descriptors, implementing timers, monitoring signalsand process events, and more.
Accelerate Framework
The Accelerate framework (Accelerate.framework) contains interfaces for performing math, big-number,and DSP calculations, among others. The advantage of using this framework over writing your own versionsof these libraries is that it is optimized for the different hardware configurations present in iOS–based devices.Therefore, you can write your code once and be assured that it runs efficiently on all devices.
Xcode Tools
The following sections describe the improvements to the Xcode tools and the support for developing iOSapplications.
Xcode Improvements
Xcode 3.2.3 introduces automatic device and provisioning-profile management in the Organizer window. Withautomatic device provisioning enabled, you can install applications on your device for debugging and testingwithout having to log in to your team portal to register the device and download a provisioning profile

●

iOS 4.0
Framework Enhancements
Note:You still need to log in to your team portal to create provisioning profiles with specificapplication IDs for in-app purchase and push notifications. However, once created, those provisioningprofiles will also be managed by Xcode if automatic device provisioning is enabled.
UI Automation API
The Instruments application now provides support for automating the testing of your iOS applications. Thebuilt-in Automation instrument works from scripts (written in JavaScript) that you provide to drive the simulationof events in your application. These synthetic events are generated with the help of the accessibility interfacesbuilt into iOS and integrated into all existing UIKit views. You can use this instrument to improve your testingprocess and deliver more robust applications.
For information about how to use the Automation instrument, seeInstruments User Guide. For informationabout the JavaScript objects and commands you use in your scripts, seeUI Automation JavaScript Reference.
Framework Enhancements
The following existing frameworks and technologies include additional incremental changes. For a completelist of new interfaces, seeiOS 4.0 API Diffs .
UIKit Framework Enhancements
The UIKit framework includes the following enhancements:
The UIApplicationclass andUIApplicationDelegateprotocol include new methods for schedulinglocal notifications and for supporting multitasking.
Drawing to a graphics context in UIKit is now thread-safe. Specifically:
The routines used to access and manipulate the graphics context can now correctly handle contextsresiding on different threads.
String and image drawing is now thread-safe.
Using color and font objects in multiple threads is now safe to do.

●
●
●

● ●

●

The UIImagePickerControllerclass includes methods for programmatically starting and stoppingvideo capture. It also includes options for selecting which camera you want to use on a device and forenabling a built-in flash.

iOS 4.0
Framework Enhancements
The UIViewclass includes new block-based methods for implementing animations. The UIWindowclass has a newrootViewControllerproperty that you can use to change the contents
of the window.
Media applications can now receive events related to the controls on an attached set of headphones. Youcan use these events to control the playback of media-related items.
Several new accessibility interfaces help you make some UI elements more accessible and allow you tocustomize your application experience specifically for VoiceOver users:
The UIAccessibilityActionprotocol makes it easy for VoiceOver users to adjust the value of UIelements, such as pickers and sliders.
UIAccessibilityFocusprotocol allows you to find out when VoiceOver is focused on an element,so you can help users avoid making unnecessary taps.
The UIAccessibilityTraitStartsMediaSessiontrait allows you to prevent VoiceOver fromspeaking during a media session that should not be interrupted.
New interfaces in UIAccessibilityprotocol allow you to specify the language in which labels andhints are spoken, and provide announcements that describe events that don't update application UIin way that would be perceptible to VoiceOver users.

●
●
●
●
●

●
●
●
●
●

The UINibclass provides a way to instantiate multiple sets of objects efficiently from the same nib file.For information about the classes of the UIKit framework, seeUIKit Framework Reference.
Foundation Framework Enhancements
The Foundation framework includes the following enhancements:
Most delegate methods are now declared in formal protocols instead of as categories onNSObject.Block-based variants are now available for many types of operations. There is new support for creating and formatting date information in NSDateandNSDateFormatter.TheNSDateComponentsclass added support for specifying time zone and quarter information.
There is support for regular-expression matching using theNSRegularExpression,NSDataDetector,andNSTextCheckingResultclasses.
The NSBlockOperationclass allows you to add blocks to operation queues. You can use the NSFileManagerclass to mark files as protected; see“Data Protection”(page 73).

●

●
●
●
●
●
●
●

iOS 4.0
Framework Enhancements
The NSFileWrapperclass allows you to work with package-based document types.
The NSOrthographyclass describes the linguistic content of a piece of text.
The NSCacheclass provides support for storing and managing temporary data.
The URL-related classes have been updated so that you can now pipeline URL requests and set requestpriorities.
For information about the classes of the Foundation framework, seeFoundation Framework Reference.
OpenGL ES Enhancements
The OpenGL ES framework includes the following enhancements:
The APPLE_framebuffer_multisampleextension enables full-scene anti-aliasing. The EXT_framebuffer_discardextension can be used to improve the performance of applications
that use depth buffers or multisample framebuffers.
The APPLE_texture_max_levelandEXT_shader_texture_lodextensions provide more controlover texture sampling.
The OES_vertex_array_object(http://www.khronos.org/registry/gles/extensions/OES/OES_vertex_ar-ray_object.txt) API allows caching of vertex array state, to decrease driver overhead.
The OES_texture_float(http://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt)andOES_texture_half_float(http://www.khronos.org/registry/gles/extensions/OES/OES_tex-ture_float.txt) extensions adds texture formats with floating point components to enable High DynamicRange rendering.
The APPLE_rgb_422(http://www.opengl.org/registry/specs/APPLE/rgb_422.txt) extension enablestexturing from some common video formats.
Performance of texture creation and modification has been significantly improved.Driver performance has been generally improved.
Game Kit Enhancements
The Game Kit framework includes a beta implementation of a centralized service called Game Center. Thisservice provides game developers with a standard way to implement the following features:
Aliases allow users to create their own online persona. Users log in to Game Center and interact with otherplayers anonymously through their alias. Players can set status messages as well as mark specific peopleas their friends.

●
●
●
●

●
●
●
●
●
●
●
●
●

●

iOS 4.0
Framework Enhancements
Leader boards allow your application to post scores to Game Center and retrieve them later.Matchmaking allows players to connect with other players with Game Center accounts.
For information about the classes of the Game Kit framework, seeGame Kit Framework Reference.
Core Location Enhancements
The Core Location framework now supports the following features:
A location monitoring service that tracks significant changes using only cellular information. This solutionoffers a lower-power alternative for determining the user’s location.
The ability to define arbitrary regions and detect boundary crossings into or out of those regions. Thisfeature can be used for proximity detection regardless of whether the application is running.
For information about the classes of the Core Location framework, seeCore Location Framework Reference.
Map Kit Enhancements
The Map Kit framework includes the following enhancements:
Support for draggable map annotationsSupport for map overlays
Draggable map annotations make it much easier to reposition those annotations after they have been addedto a map. The Map Kit framework handles most of the touch events associated with initiating, tracking, andending a drag operation. However, the annotation view must work in conjunction with the map view delegateto ensure that dragging of the annotation view is supported.
Map overlays provide a way to create more complex types of annotations. Instead of being pinned to a singlepoint, an overlay can represent a path or shape that spans a wider region. You can use overlays to layerinformation such as bus routes, election maps, park boundaries, and weather maps on top of the map.
For information about the functions and types of the Map Kit framework, seeMap Kit Framework Reference.

●
●

Important:GameCenterisavailabletodevelopersonlyiniOS4.Itisintroducedasadeveloper-onlyfeatureso that you can provide feedback as you implement and test Game Center features in your applications.However, Game Center is not a user feature in iOS 4 and you should not deploy applications that use it tothe App Store.

●
●

●
●

iOS 4.0
Inherited Improvements
Message UI Enhancements
The Message UI framework includes a newMFMessageComposeViewControllerclass for composing SMSmessages. This class manages a standard system interface for composing and sending SMS messages. Incontrast with sending SMS messages using a specially formatted URL, this class allows you to create and sendthe message entirely from within your application.
Core Graphics Enhancements
The Core Graphics framework includes the following enhancements:
The ability to embed metadata into PDF files using theCGPDFContextAddDocumentMetadatafunctionSupport for creating color spaces using an ICC profile Graphics context support for font smoothing and fine-grained pixel manipulation
For information about the functions and types of the Core Graphics framework, seeCore Graphics FrameworkReference.
ICU Enhancements
The International Components for Unicode (ICU) libraries were updated to version 4.4. ICU is an open-sourceproject for Unicode support and software internationalization. The installed version of ICU includes only asubset of the header files that are part of the broader ICU library. Specifically, iOS includes only the headersused to support regular expressions.
Inherited Improvements
Although iOS 3.2 does not run on iPhone and iPod touch devices, many of the features introduced in thatversion of the operating system are also supported in iOS 4. Specifically, iOS 4 supports:

●
●
●

●
●
●
●

Custom input viewsConnecting external displaysFile-sharing support Gesture recognizers
2013-10-22

iOS 4.0
Inherited Improvements
Core Text for text layout and rendering Text input through integration with the keyboardCustom fonts ICU Regular Expressions Document types PDF generation Xcode Tools changes UIKit framework changes Media Player framework changes Core Animation changes Foundation framework changes

●
●
●
●
●
●
●
●
●
●
●

2013-10-22

Document Revision History
This table describes the changes toWhat's New in iOS.

Date

Notes

2013-10-222013-09-182013-01-282012-09-25
2012-09-19
2012-03-072011-10-122011-02-282010-11-152010-08-172010-07-082010-06-042010-03-24

Updated the web links for OpenGL ES extensions added in iOS 7.
Added new features introduced in iOS 6.1.
The links to the OpenGL ES extensions added in iOS 6 now point to thefinal versions posted on the Khronos website.
Updated to include features introduced in iOS 6.Removed older articles containing changes in iOS 3.x.
Updated to include features introduced in iOS 5.1.Updated to include features introduced in iOS 5.0.Added features introduced in iOS 4.3. Added features introduced in iOS 4.2.
Added features introduced in iOS 4.1.
Changed the title from "What's New in iPhone OS."
Moved the iOS 3.1 information to its own article and added a new articlecovering features in iOS 3.2.

Document Revision History

Date

Notes

2009-08-27
2009-06-16

Updated the iOS 3.0 article to reflect features introduced in all 3.x versionsof iOS.
Added new features related to the introduction of new iPhone hardware.

No part of this publication may be reproduced,stored in a retrieval system, or transmitted, in anyform or by any means, mechanical, electronic,photocopying, recording, or otherwise, withoutprior written permission of Apple Inc., with thefollowing exceptions: Any person is herebyauthorized to store documentation on a singlecomputer for personal use only and to printcopies of documentation for personal useprovided that the documentation containsApple’s copyright notice.
No licenses, express or implied, are granted withrespect to any of the technology described in thisdocument. Apple retains all intellectual propertyrights associated with the technology describedin this document. This document is intended toassist application developers to developapplications only for Apple-labeled computers.
Apple Inc. 1 Infinite LoopCupertino, CA 95014408-996-1010
Apple, the Apple logo, AirPlay, Apple TV, Cocoa,Cocoa Touch, iCal, Instruments, iPad, iPhone, iPod,iPod touch, iTunes, Keychain, Mac, Mac OS,Objective-C, OS X, Passbook, QuickTime, Safari,and Xcode are trademarks of Apple Inc.,registered in the U.S. and other countries.
AirDrop is a trademark of Apple Inc.
iAd and iCloud are service marks of Apple Inc.,registered in the U.S. and other countries.
App Store is a service mark of Apple Inc.
Java is a registered trademark of Oracle and/orits affiliates.
OpenGL is a registered trademark of SiliconGraphics, Inc.
UNIX is a registered trademark of The OpenGroup.
Even though Apple has reviewed this document,APPLE MAKES NO WARRANTY OR REPRESENTATION,EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THISDOCUMENT, ITS QUALITY, ACCURACY,MERCHANTABILITY, OR FITNESS FOR A PARTICULARPURPOSE. AS A RESULT, THIS DOCUMENT IS PROVIDED“AS IS,” AND YOU, THE READER, ARE ASSUMING THEENTIRE RISK AS TO ITS QUALITY AND ACCURACY.
IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIALDAMAGES RESULTING FROM ANY DEFECT ORINACCURACY IN THIS DOCUMENT, even if advised ofthe possibility of such damages.
THE WARRANTY AND REMEDIES SET FORTH ABOVEARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORALOR WRITTEN, EXPRESS OR IMPLIED. No Apple dealer,agent, or employee is authorized to make anymodification, extension, or addition to this warranty.

Some states do not allow the exclusion or limitationof implied warranties or liability for incidental orconsequential damages, so the above limitation orexclusion may not apply to you. This warranty givesyou specific legal rights, and you may also have otherrights which vary from state to state.


展开全文
• information that should help you find out what is causing the crash. 问题补充： 我把 my.ini 文件里面的table_cache=256 这句暂时注释掉。问题解决了。 转载于:...
• 8200 bytes is the minimum size for read_buffer_size, this is why we start from this value. As you can see results look really strange. Performance indeed grows by few percent as you increase ...
• (adsbygoogle = window.adsbygoogle || []).push({});...What are the lesser known but useful data structures? There are some data structures around that are really useful but are unknown to most programmers
• What are Huge Pages and the advantages of using them? SOLUTION 已验证- 已更新2014年六月25日18:18- English 环境 Red Hat Enterprise Linux 6 Red Hat Enterprise Li...
• 与通道数样本长度无关。 例子： 1帧立体声48khz 16位的pcm数据长度为4bytes 1帧5.1正道48k 16位pcm流的大小为12bytes 一个period就是每两次硬件中断之间的帧数。poll()会每个周期return一次。 buffer是一个环形...
• ## 关于page size的转摘

千次阅读 2014-01-13 16:27:24
看好多论文源码中都有Page Size的概念，我却一直比较模糊，今天特地仔细查了一下。   基本概念 In the context of   computer   virtual memory , a   page ,   memory page , or   virtual page...
• pytorch报了一堆错， 首先是类似这样的重复出现: /opt/conda/conda-bld/pytorch_1573049304260/work/aten/src/ATen/native/cuda/IndexKernel.cu:60: lambda [](int)->...= -sizes[i] && index
• WELCOME TO PYTORCH TUTORIALS 要学习如何使用PyTorch，请从...如果您希望通过IPython / Jupyter交互式地学习教程，那么每个教程都有一个用于Jupyter笔记本Python源代码的下载链接。PyTorch示例中还提供了其他高...
• 解释一：为了增强程序的可移植性，便有了size_t，它是为了方便系统之间的移植而定义的，不同的系统上，定义size_t可能不一样。  在32位系统上 定义为 unsigned int 也就是说在32位系统上是32位无符号整形。在64位...
• ## matlab中size()的用法

万次阅读 2014-11-21 16:43:52
size(A)函数是用来求矩阵的大小的,你必须首先弄清楚A到底是什么，大小是多少。 比如说一个A是一个3×4的二维矩阵：  1、size（A） %直接显示出A大小  输出：ans=  3 4  2、s=size（A）%返回一个...
• http://stackoverflow.com/questions/79923/what-and-where-are-the-stack-and-heap ...What and where are the stack and heap? up vote2015down votefavorite 1237
• How to view local and network socket connections and buffer sizes in Red Hat Enterprise Linux 环境 Red Hat Enterprise Linux (RHEL) All Versions 问题 How can I find out what connections are ...
• what is tcp buffer sizeTCP/IP buffers are too large and applications are not processing data fast enough ...
• What if Not Enough HugePages Configured? Configuring your Linux OS for HugePages is a delicate process where if you do not configure properly, the system may experience serious problems. If you do ...
• In computing, word size refers to the maximum number of bits that a CPU can process at a time. A word is a fixed-sized piece of data which is dictated by the processor hardware architecture; fixed in ...
• First, I used pwr.t.test to do a power analysis to see what sample size I needed to obtain a power of 0.8, assuming a small but not tiny effect size, at a level of significance of 0.05. It told me I ...
• What is the difference between pages and blocks?A block is the smallest unit of data that an operating system ca...
• The file format identifies relevant information about the service being offered so that the user knows what it is for. It might also contain a bar code or other information that you can then use to ...
• one epoch = one forward pass and one backward pass of all the training ...batch size = the number of training examples in one forward/backward pass. The higher the batch size, the more memory sp...
• I was playing around with a wide variety of image sizes to learn how Whatsapp compresses them. For example, an image with dimensions 3264×2448 (3 MB) is converted to an image with dimensions 800×...
• http://www.cssreset.com/what-is-a-css-reset/ A CSS Reset (or “Reset CSS”) is a short, often compressed (minified) set of CSS rules thatresets the styling of all ...
• http://stackoverflow.com/questions/3279543/what-is-the-copy-and-swap-idiom
• 动手写SelfAttetiontransformer Encoder模型实现电影情感分类 通过代码学习，加深对Self Attention Transformer 模型实现理解 数据预处理分析，掌握torchtext 在数据预处理应用 Self Attention 机制模型...
• Still a lot of sort merge passes lets go with even higherbuffer sizes. set sort_buffer_size=1000000; mysql> select * from gt order by i desc limit 10; 10 rows in set (0.70 sec) mysql> show...
• from: http://www.smashingmagazine.com/2014/10/02/what-every-app-developer-should-know-about-android/ In today’s fast-paced mobile market, consumers have no patience for mobile apps that ...

...